{"record":{"id":"0ce7dba783845cac","repo":"gatsbyjs/gatsby","slug":"11901","errorCode":"11901","errorMessage":"Failed to compile Gatsby files ${origin ? `(${origin})` : ``}:\\n    ${generalMessage}. ${specificMessage ?? ``}\\n    ${hints}\\n    ${filePath ? `File path: ${filePath}` : ``}","messagePattern":"Failed to compile Gatsby files (.+?)\\)` : ``\\}:\\\\n    (.+?)\\. (.+?)\\\\n    (.+?)\\\\n    (.+?)` : ``\\}","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby/src/utils/parcel/compile-gatsby-files.ts","lineNumber":262,"sourceCode":"          sourceMessage: error.message,\n        },\n      })\n    }\n  }\n}\n\nfunction handleErrors(diagnostics: Array<Diagnostic>): void {\n  diagnostics.forEach(err => {\n    if (err.codeFrames) {\n      err.codeFrames.forEach(c => {\n        // Assuming that codeHighlights only ever has one entry in the array. Local tests only ever showed one\n        const codeHighlightsMessage = c?.codeHighlights[0]?.message\n        // If both messages are the same don't print the specific, otherwise they would be duplicate\n        const specificMessage =\n          codeHighlightsMessage === err.message\n            ? undefined\n            : codeHighlightsMessage\n        reporter.panic({\n          id: `11901`,\n          context: {\n            filePath: c?.filePath,\n            generalMessage: err.message,\n            specificMessage,\n            origin: err?.origin,\n            hints: err?.hints,\n          },\n        })\n      })\n    } else {\n      reporter.panic({\n        id: `11901`,\n        context: {\n          generalMessage: err.message,\n          origin: err?.origin,\n          hints: err?.hints,\n        },","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby/src/utils/parcel/compile-gatsby-files.ts#L244-L280","documentation":"Thrown by `handleErrors` for each Parcel diagnostic that includes `codeFrames`. Gatsby formats the diagnostic into a panic containing the file path (from the first code frame), the general message, an optional specific message (only when it differs from the general one to avoid duplication), the diagnostic origin, and hints. This is the user-facing surface for compile errors in gatsby-node/gatsby-config that carry source location info.","triggerScenarios":"Parcel emits a `Diagnostic` with a populated `codeFrames` array while compiling `gatsby-node.{ts,js}` or `gatsby-config.{ts,js}`. Concretely: a TypeScript syntax/type error, an invalid import, an export-const/getConfig signature mistake, or any source-level Parcel error with a code frame.","commonSituations":"Writing a new gatsby-node.ts with a typo or bad import; using an API that does not exist in the installed Gatsby version; TS strict-mode errors in config; referencing a module not installed; plugin gatsby-node files with syntax errors.","solutions":["Open the `File path` from the message and fix the reported error at the indicated location.","Address the `hints` Parcel provides (often 'Cannot find module X' → install it, or a typo fix).","If it is a TS error, run `tsc --noEmit` on the file to get the full list.","Re-run with `--verbose` for additional context if the frame is insufficient."],"exampleFix":"// before (gatsby-node.ts)\nimport { createPages } from \"gatby\" // typo\n// after\nimport { createPages } from \"gatsby\"","handlingStrategy":"try-catch","validationCode":"// Type-check gatsby-node / gatsby-config before invoking Gatsby compile.\n// package.json script: \"prebuild\": \"tsc --noEmit -p .\"","typeGuard":"function isParcelDiagnosticWithFrame(err) {\n  return err != null && Array.isArray(err.codeFrames) && err.codeFrames.length > 0\n}","tryCatchPattern":null,"preventionTips":["Type-check gatsby-node.ts and gatsby-config.ts in CI (tsc --noEmit).","Install imported packages before referencing them in gatsby-node.","Keep an eye on the `origin`/`hints` fields; they name the failing rule.","Use a starter that already compiles, then edit incrementally."],"tags":["parcel","compilation","typescript","gatsby-node","diagnostics","code-frame"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}