{"record":{"id":"183b8be4ca804ec1","repo":"gatsbyjs/gatsby","slug":"syntax-error-in-abspath-err-message-cod","errorCode":null,"errorMessage":"Syntax error in \"${absPath}\":\n${err.message}\n${codeFrame}","messagePattern":"Syntax error in \"(.+?)\":\n(.+?)\n(.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby/src/bootstrap/resolve-module-exports.ts","lineNumber":42,"sourceCode":"  const code = fs.readFileSync(absPath, `utf8`) // get file contents\n\n  let ast\n  try {\n    ast = babelParseToAst(code, absPath)\n  } catch (err) {\n    if (err instanceof SyntaxError) {\n      // Pretty print syntax errors\n      const codeFrame = codeFrameColumns(\n        code,\n        {\n          start: (err as unknown as { loc: SourceLocation[\"start\"] }).loc,\n        },\n        {\n          highlightCode: true,\n        }\n      )\n\n      report.panic(\n        `Syntax error in \"${absPath}\":\\n${err.message}\\n${codeFrame}`\n      )\n    } else {\n      // if it's not syntax error, just throw it\n      throw err\n    }\n  }\n\n  let isCommonJS = false\n  let isES6 = false\n\n  // extract names of exports from file\n  traverse(ast, {\n    // Check if the file is using ES6 imports\n    ImportDeclaration: function ImportDeclaration() {\n      isES6 = true\n    },\n","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/e85d62f1779e353eaac1753211629a26d123e26c/packages/gatsby/src/bootstrap/resolve-module-exports.ts#L24-L60","documentation":"Fires when Babel fails to parse a file during static export analysis in staticallyAnalyzeExports: because the caught error is a SyntaxError, the panic pretty-prints it with a code frame pinpointing the offending line/column of the module.","triggerScenarios":"Thrown at packages/gatsby/src/bootstrap/resolve-module-exports.ts:42 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the JavaScript syntax error at the location shown in the code frame"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e85d62f1779e353eaac1753211629a26d123e26c","analyzedAt":"2026-08-26T17:50:09.662Z","contentChangedAt":"2026-08-26T17:50:09.662Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}