# 500 error querying custom type

**URL:** <https://community.prismic.io/t/500-error-querying-custom-type/5978>\
**Category:** Developing with Prismic\
**Tags:** nextjs\
**Created:** [June 28, 2021, 7:53am UTC](https://community.prismic.io/t/500-error-querying-custom-type/5978 "2021-06-28T07:53:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![joey.livingston](https://avatars.discourse-cdn.com/v4/letter/j/8edcca/32.png) [@joey.livingston](https://community.prismic.io/u/joey.livingston)\
**Post date:** [June 28, 2021, 7:53am UTC](https://community.prismic.io/t/500-error-querying-custom-type/5978/1 "2021-06-28T07:53:52Z")

</div>

Querying works for all custom post types of mine, except this one.. we are paid users. I have the following code to query the custom type:

```auto
const API = await Prismic.api(PRISMIC_API_URL);
        const response = await API.query(
          Prismic.Predicates.at('document.type', 'ljc_case'),
          {
            orderings: '[my.ljc_case.date desc]',
            ...params
          }
        );

```

The Prismic api response is: "Error: Unexpected status code [500] on URL [https://liberty-justice-center.cdn.prismic.io/api/v2/documents/search?page=1&pageSize=5&orderings=[my.ljc\_case.date%20desc]&ref=YNls\_RIAACIAlefp&q=[[at(document.type%2C%20"ljc\_case")]]](https://liberty-justice-center.cdn.prismic.io/api/v2/documents/search?page=1&pageSize=5&orderings=%5Bmy.ljc_case.date%20desc%5D&ref=YNls_RIAACIAlefp&q=%5B%5Bat(document.type%2C%20%22ljc_case%22)%5D%5D)"

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [June 28, 2021, 10:36am UTC](https://community.prismic.io/t/500-error-querying-custom-type/5978/2 "2021-06-28T10:36:25Z")

</div>

Hi Jake,

Welcome to the community!

I quickly checked your API Browser for the type you're querying and it's coming back broken, which suggested there's an error in this Custom Type or at least one of the documents using a newer version of this Custom Type:  
[https://liberty-justice-center.prismic.io/api/v2/documents/search?ref=YNls\_RIAACIAlefp&q=[[at(document.type%2C+"ljc\_case")]]#format=json](https://liberty-justice-center.prismic.io/api/v2/documents/search?ref=YNls_RIAACIAlefp&q=%5B%5Bat(document.type%2C+%22ljc_case%22)%5D%5D#format=json)

Have you made any changes in the Custom Type JSON recently which could be causing this?

Further investigating would suggest it's the 3rd result, whatever that is.

[https://liberty-justice-center.prismic.io/api/v2/documents/search?ref=YNls\_RIAACIAlefp&q=[[at(document.type%2C+"ljc\_case")]]&pageSize=1&page=3#format=json](https://liberty-justice-center.prismic.io/api/v2/documents/search?ref=YNls_RIAACIAlefp&q=%5B%5Bat(document.type%2C+%22ljc_case%22)%5D%5D&pageSize=1&page=3#format=json)

Thanks.

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [June 28, 2021, 2:51pm UTC](https://community.prismic.io/t/500-error-querying-custom-type/5978/4 "2021-06-28T14:51:00Z")

</div>

OK, so the team investigated this further. They're pretty sure you did an import that causes an issue in the API because of unexpected formatting. Specifically a document link.

There is a Group “Legal Briefs” defined in the custom type “LJC Case”. One of them is a document link (broken). The other links are attachment links.

To resolve this you need to go over all “LJC Case” documents and remove these broken document links.

The other option is to wait until we deploy the fix they made, which would be deployed this week or next.

---

<div class="post-metadata">

**Author:** ![joey.livingston](https://avatars.discourse-cdn.com/v4/letter/j/8edcca/32.png) [@joey.livingston](https://community.prismic.io/u/joey.livingston)\
**Post date:** [June 28, 2021, 5:23pm UTC](https://community.prismic.io/t/500-error-querying-custom-type/5978/5 "2021-06-28T17:23:25Z")

</div>

Thanks a ton Phil! I’ve passed this along to the appropriate team members.

Best Regards,

Joey Livingston

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [July 5, 2021, 8:42am UTC](https://community.prismic.io/t/500-error-querying-custom-type/5978/6 "2021-07-05T08:42:11Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [December 9, 2021, 3:39pm UTC](https://community.prismic.io/t/500-error-querying-custom-type/5978/7 "2021-12-09T15:39:18Z")

</div>


