{"record":{"id":"74bd31eaeace43fd","repo":"gatsbyjs/gatsby","slug":"10128","errorCode":"10128","errorMessage":"It looks like you were trying to add the gatsby-node file? Please rename \"${nearMatch}\" to \"${configName}.${isTSX ? `ts` : `js`}\"","messagePattern":"It looks like you were trying to add the gatsby-node file\\? Please rename \"(.+?)\" to \"(.+?)\\.(.+?)\"","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby/src/utils/parcel/compile-gatsby-files.ts","lineNumber":122,"sourceCode":"      // Of course, allow valid gatsby-node files\n      if (\n        file === `gatsby-node.js` ||\n        file === `gatsby-node.mjs` ||\n        file === `gatsby-node.ts`\n      ) {\n        break\n      }\n\n      // Check for likely misnamed files\n      if (isNearMatch(name, gatsbyNodeName, 3)) {\n        nearMatch = file\n      }\n    }\n\n    // gatsby-node is misnamed\n    if (nearMatch) {\n      const isTSX = nearMatch.endsWith(`.tsx`)\n      reporter.panic({\n        id: `10128`,\n        context: {\n          configName: gatsbyNodeName,\n          nearMatch,\n          isTSX,\n        },\n      })\n    }\n\n    const worker = new WorkerPool<typeof import(\"./compile-gatsby-files\")>(\n      require.resolve(`./compile-gatsby-files`),\n      {\n        numWorkers: 1,\n      }\n    )\n\n    const distDir = `${siteRoot}/${COMPILED_CACHE_DIR}`\n    await ensureDir(distDir)","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby/src/utils/parcel/compile-gatsby-files.ts#L104-L140","documentation":"Thrown during Gatsby-file compilation when no exact `gatsby-node.ts`/`gatsby-node.js` is found but a near-match filename exists within edit distance 3 (isNearMatch). Gatsby assumes the user intended the canonical name and mistyped it (e.g. gatsby-nodees.js, gastby-node.ts). The panic includes the near match and suggests the correct name, choosing `.ts` over `.js` only when the typo ended in `.tsx`.","triggerScenarios":"Project root or a plugin dir contains a file like `gatsb-node.ts`, `gatsby-node.jsx`, `gatsbuy-node.js`, or similar within Levenshtein distance 3 of `gatsby-node`, and no exact `gatsby-node.{ts,js}` is present. The compile-gatsby-files scan sets `nearMatch` and panics instead of silently ignoring it.","commonSituations":"Renaming a file and making a typo; importing a starter that had a typo'd filename; legacy `.jsx`/`.tsx` confusion where the user wrote gatsby-node.tsx (suggested as .ts); copying gatsby-node from a tutorial and dropping a character.","solutions":["Rename the suggested `nearMatch` file to exactly `gatsby-node.ts` (or `gatsby-node.js`).","If the file is unrelated, rename it to something farther than distance 3 from `gatsby-node` so the heuristic no longer matches.","Delete the stray near-match file if it was created by accident."],"exampleFix":"// before (file in project root)\n//   gastby-node.ts\n// after\n//   gatsby-node.ts","handlingStrategy":"validation","validationCode":"// Scan the project root for near-matches before invoking the compiler.\nconst fs = require('fs')\nconst { isNearMatch } = require('./is-near-match') // or inline Levenshtein<=3\nfunction findGatsbyNodeTypos(root) {\n  const target = 'gatsby-node'\n  const files = fs.readdirSync(root)\n  const exact = files.some(f => /^gatsby-node\\.(ts|js)$/.test(f))\n  if (exact) return []\n  return files.filter(f => isNearMatch(f.replace(/\\.(t|j)sx?$/, ''), target, 3))\n}","typeGuard":"function hasExactGatsbyNode(files) {\n  return files.some(f => /^gatsby-node\\.(ts|js)$/.test(f))\n}","tryCatchPattern":null,"preventionTips":["Use a project template/starter so the canonical gatsby-node filename is present from the start.","Add an editor lint or precommit check that flags files within edit distance 3 of gatsby-node.","When renaming, copy then delete to avoid leaving a typo'd sibling."],"tags":["configuration","gatsby-node","filename","typescript","developer-experience"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}