"Unexpected token < in JSON at position 0" errors (@prismicio/gatsby-source-prismic-graphql)

I recently made a small change (3 new fields) to a few of the page types in our Prismic instance and added a reference to three new fields in the graphql query of our Gatsby app.

When I run gatsby develop or gatsby build now, we get a long run of errors that read as follows:

`
ERROR #85901 GRAPHQL

There was an error in your GraphQL query:

Unexpected token < in JSON at position 0

1 | query SubpageQuery($uid: String!) {
2 | prismic {

3 | allSubpages(uid: $uid) {
| ^
4 | edges {
5 | node {
6 | _meta {
7 | uid
8 | id
9 | }
10 | title
11 | meta_description
12 | meta_keywords
13 | meta_title

File path: /Users/sean/Documents/dev/npf-website/src/templates/Subpage.jsx
Url path: /letter-in-support-of-wa-um-bill-hb1879/
Plugin: none
`

What is odd about this is that if I remove the reference to the new field for that page type, the site builds fine. It isn't anything fancy, just a url field (key text) in a slice.

Anecdotally, it seems to me that the pages failing on build have longer UIDs.... Any guesses on this one? I"m aware that this plugin has been deprecated, but the site was largely built before that happened and it would be painful to switch at this point.

Hey Sean, many times this happens because the cache needs to be deleted in order for the schema to be rebuilt. You do this by running gatsby clean and then just gatsby develop or gatsby build. Could you try this and tell me if this fixes anything ?

Thanks for the response @Pau , i had definitely run a gatsby clean before my build (it is part of my startup script), but I double checked and for some reason now it seems to build OK without those errors. We'll chalk this one up to the 'mysteriously fixed itself' category. Thanks!

I'm glad, haha the mysteriously fixed category is always possible!

Let me know if you have any further questions about this or anything else