Unexpected status code [400] on URL

Hi if i try to load some data I get only an error

  async asyncData({ $prismic, error }) {
      const homepage = (await $prismic.api.getSingle('home')).data
    } catch (e) {
      // error({ statusCode: 404, message: 'Page not found' })
Error: Unexpected status code [400] on URL https://appname.cdn.prismic.io/api/v2/documents/search?page=1&pageSize=1&routes=%5B%7B%22type%22%3A%22page%22%2C%22path%22%3A%22%2F%3Auid%22%7D%5D&ref=%7B%22_tracker%22%3A%22enCOgHsT%22%7D&q=%5B%5Bat(document.type%2C%20%22home%22)%5D%5D
    at /Path/appname/node_modules/@prismicio/client/cjs/@prismicio/client.js:1005:25
    at processTicksAndRejections (node:internal/process/task_queues:94:5) {
  status: 400

If I click on the url I get this message

{"type":"Link resolver error","message":"[Link resolver error] Unknown type\nDeclared type: page\nExpected one of:\n- sdfgsdfg\n- dd\n- home"}

if I open the toolbar then I see the data

I have followed the steps from there

and then have done this

last I added a link resolver file

export default function (doc) {
  if (doc.isBroken) {
    return '/not-found';

  if (doc.type === 'home') {
    return '/';

  return '/not-found';

any idea what I'm doing wrong?


Hi Gregor,

I'm really sorry about the delay in replying. I'll be happy to help debug this with you.

Can you send me your repository URL so I can look into this further?


hi thank you :wink:

there you can take a look what I have done so far

Hey Gregor,

So the issue is coming from the default route resolver in the nuxt file suggested here. You can remove it since you are using the link resolver. I'll remove it from the documentation example so this doesn't happen in the future.

I was able to test this by changing the page type in your above URL



do you mean this piece of code?

routes: [{
  type: "page",
  path: "/:uid"

Yes, you can remove the entire apiOptions object:

1 Like

works now thank you :wink:

1 Like

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