{"record":{"id":"88c854ea9e51547d","repo":"gatsbyjs/gatsby","slug":"stringifiederrors","errorCode":null,"errorMessage":"stringifiedErrors","messagePattern":"stringifiedErrors","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby-source-wordpress/src/utils/fetch-graphql.ts","lineNumber":812,"sourceCode":"      e,\n      reporter,\n      url,\n      timeout,\n      variables,\n      pluginOptions,\n      query,\n      response,\n      errorContext,\n      isFirstRequest,\n    })\n  }\n\n  if (throwGqlErrors && response.data.errors) {\n    const stringifiedErrors: string = response.data.errors\n      .map((error: { message: string }) => error.message)\n      .join(`\\n\\n`)\n\n    throw new Error(stringifiedErrors)\n  }\n\n  if (!ignoreGraphQLErrors) {\n    await handleGraphQLErrors({\n      query,\n      variables,\n      response,\n      errorMap,\n      panicOnError,\n      reporter,\n      errorContext,\n      forceReportCriticalErrors,\n    })\n  }\n\n  return response?.data\n}\n","sourceCodeStart":794,"sourceCodeEnd":830,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby-source-wordpress/src/utils/fetch-graphql.ts#L794-L830","documentation":"When throwGqlErrors is true and the WPGraphQL response carries a `data.errors` array, fetch-graphql joins every error message with double newlines and throws the resulting string. This surfaces raw GraphQL validation/runtime errors (e.g. 'Cannot query field X on type Y') as a single Error. It only fires when the caller explicitly opts into throwing GraphQL errors rather than the default handleGraphQLErrors reporting path.","triggerScenarios":"A query references a field that does not exist in the WPGraphQL schema; a WPGraphQL permission error on a field; type mismatch in a mutation; schema drift after WPGraphQL version upgrade removed/renamed fields.","commonSituations":"WPGraphQL upgraded and a field was removed/renamed; custom WPGraphQL fields unavailable because the extending plugin was deactivated; querying private fields without authentication; schema cache stale after a WordPress post type change.","solutions":["Read the thrown message — it lists every GraphQL error verbatim; fix the offending query/field.","If the schema changed, regenerate introspection and update any custom queries in pluginOptions.","Re-authenticate if the errors are permission-related (htaccess credentials or WPGraphQL JWT).","If errors are spurious, clear the WPGraphQL schema cache on the WordPress side."],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"function hasGqlErrors(r): r is { data: { errors: Array<{ message: string }> } } { return r && Array.isArray(r.data?.errors) && r.data.errors.length > 0 }","tryCatchPattern":"try { await fetchGraphQL({ ...opts, throwGqlErrors: true }) } catch (e) { if (/Cannot query field|Field .* doesn't exist/.test(e.message)) { reporter.warn(`Schema mismatch from WPGraphQL: ${e.message}`) } throw e }","preventionTips":["Regenerate WPGraphQL introspection after schema changes","Pin WPGraphQL and plugin versions together","Validate custom queries against the live schema in a dev build before production","Clear the WPGraphQL schema cache after activating/deactivating extending plugins"],"tags":["wordpress","graphql","schema","validation"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}