{"record":{"id":"06e25f478cb99fc0","repo":"gatsbyjs/gatsby","slug":"app-chunk-not-found","errorCode":null,"errorMessage":"\"app\" chunk not found","messagePattern":"\"app\" chunk not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/gatsby/src/utils/webpack/plugins/partial-hydration.ts","lineNumber":432,"sourceCode":"        normalModuleFactory.hooks.parser\n          .for(`javascript/esm`)\n          .tap(this.name, parserCallback)\n        normalModuleFactory.hooks.parser\n          .for(`javascript/dynamic`)\n          .tap(this.name, parserCallback)\n\n        // add dangling css modules to the app entry\n        compilation.hooks.optimizeChunks.tap(this.name, () => {\n          let appChunk: webpack.Chunk | null = null\n          for (const chunk of compilation.chunks) {\n            if (chunk.name === `app`) {\n              appChunk = chunk\n              break\n            }\n          }\n\n          if (!appChunk) {\n            throw new Error(`\"app\" chunk not found`)\n          }\n\n          const modulesToInsertIntoApp: Array<webpack.Module> = []\n\n          for (const cssModule of this._collectedCssModules) {\n            const usedInChunks =\n              compilation.chunkGraph.getModuleChunksIterable(cssModule)\n\n            let isInAnyChunk = false\n\n            for (const _ of usedInChunks) {\n              isInAnyChunk = true\n              break\n            }\n            if (!isInAnyChunk) {\n              modulesToInsertIntoApp.push(cssModule)\n            }\n          }","sourceCodeStart":414,"sourceCodeEnd":450,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/e85d62f1779e353eaac1753211629a26d123e26c/packages/gatsby/src/utils/webpack/plugins/partial-hydration.ts#L414-L450","documentation":"In optimizeChunks the plugin scans compilation.chunks for the chunk named 'app' to attach dangling CSS modules; not finding it means the expected app entry/chunk was absent at that hook — a build-internal invariant, often from customized entries or a changed Gatsby webpack setup.","triggerScenarios":"Thrown at packages/gatsby/src/utils/webpack/plugins/partial-hydration.ts:432 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Avoid webpack config changes that rename or remove the 'app' entry","Update Gatsby to a version with partial-hydration chunk fixes","Disable partial hydration if not needed"],"exampleFix":null,"handlingStrategy":"type-guard","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-14T05:17:10.506Z"}