{"record":{"id":"e0ebb19570674db5","repo":"gatsbyjs/gatsby","slug":"node-mutation-detected-codeframe-codeframe","errorCode":null,"errorMessage":"Node mutation detected\n\n${codeFrame ? `${codeFrame}\\n\\n` : ``}${error.stack.replace(/^Error:?\\s*/, ``)}","messagePattern":"Node mutation detected\n\n(.+?)\\\\n\\\\n` : ``\\}(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby/src/utils/detect-node-mutations.ts","lineNumber":85,"sourceCode":"  onSet?: (target: any, key: string | symbol, value: any) => boolean | undefined\n} = {}): ProxyHandler<any> {\n  function set(target, key, value): boolean {\n    if (onSet) {\n      const result = onSet(target, key, value)\n      if (result !== undefined) {\n        return result\n      }\n    }\n\n    const error = new Error(`Stack trace:`)\n    Error.captureStackTrace(error, set)\n\n    if (error.stack && !reported.has(error.stack)) {\n      reported.add(error.stack)\n      const codeFrame = getNonGatsbyCodeFrameFormatted({\n        stack: error.stack,\n      })\n      reporter.warn(\n        `Node mutation detected\\n\\n${\n          codeFrame ? `${codeFrame}\\n\\n` : ``\n        }${error.stack.replace(/^Error:?\\s*/, ``)}`\n      )\n    }\n    return true\n  }\n\n  function get(target, key): any {\n    const value = target[key]\n\n    if (onGet) {\n      const result = onGet(key, value)\n      if (result !== undefined) {\n        return result\n      }\n    }\n","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/e85d62f1779e353eaac1753211629a26d123e26c/packages/gatsby/src/utils/detect-node-mutations.ts#L67-L103","documentation":"In the proxy `set` trap used by GATSBY_DETECT_NODE_MUTATIONS, a mutation of a node field was observed. The warning includes a stack trace and code frame pointing at the mutation site. This is a diagnostic guard enabled only when GATSBY_DETECT_NODE_MUTATIONS is set; direct node mutations break Gatsby's change-tracking invariants.","triggerScenarios":"Thrown at packages/gatsby/src/utils/detect-node-mutations.ts:85 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Find the mutation site from the printed stack/code frame and stop mutating nodes directly","Use createNode or createNodeField actions instead of assigning properties on existing nodes","Disable GATSBY_DETECT_NODE_MUTATIONS after diagnosis to restore build performance"],"exampleFix":null,"handlingStrategy":"validation","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"}