{"record":{"id":"ec06a1d9696fe882","repo":"gatsbyjs/gatsby","slug":"missing-compiler","errorCode":null,"errorMessage":"Missing compiler","messagePattern":"Missing compiler","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"packages/gatsby/src/services/recompile.ts","lineNumber":23,"sourceCode":"import reporter from \"gatsby-cli/lib/reporter\"\nimport { emitter } from \"../redux\"\nimport { buildRenderer } from \"../commands/build-html\"\nimport { Stage } from \"../commands/types\"\nimport { clearRequireCacheRecursively } from \"../utils/clear-require-cache\"\n\nexport async function recompile(context: IBuildContext): Promise<Stats> {\n  const [stats] = await Promise.all([\n    recompileDevBundle(context),\n    recompileSSRBundle(context),\n  ])\n  return stats\n}\n\nasync function recompileDevBundle({\n  webpackWatching,\n}: IBuildContext): Promise<Stats> {\n  if (!webpackWatching) {\n    reporter.panic(`Missing compiler`)\n  }\n  return new Promise<Stats>(resolve => {\n    function finish(stats: Stats): void {\n      emitter.off(`COMPILATION_DONE`, finish)\n      resolve(stats)\n    }\n    emitter.on(`COMPILATION_DONE`, finish)\n    webpackWatching.resume()\n    // Suspending is just a flag, so it's safe to re-suspend right away\n    webpackWatching.suspend()\n  })\n}\n\nasync function recompileSSRBundle({\n  program,\n  websocketManager,\n  recompiledFiles = new Set(),\n}: IBuildContext): Promise<void> {","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby/src/services/recompile.ts#L5-L41","documentation":"During develop-mode recompilation (hot reload of changes), Gatsby expects the webpackWatching instance (the webpack watcher) to be present on the build context. If it is undefined -- meaning the webpack dev server was never started or the context was not properly initialized -- the recompile cannot proceed.","triggerScenarios":"The recompileDevBundle function is called when webpackWatching on IBuildContext is falsy. This happens when the develop state machine enters the recompile step without having first run startWebpackServer, or if the watcher was lost due to a prior crash.","commonSituations":"State machine ordering bug where recompile runs before webpack server start. A prior webpack crash destroyed the watcher context. Custom integrations that call recompile directly without establishing the dev server. Internal regression in develop bootstrap flow.","solutions":["Run `gatsby clean` and restart `gatsby develop` -- this is almost always a transient state corruption.","If it persists, update Gatsby to the latest patch version -- this path is an internal invariant that should not be reachable.","Report a bug with a minimal reproduction if it occurs on a clean cache with the latest version."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// Ensure webpackWatching is present before calling recompile\nfunction hasWebpackWatching(ctx) {\n  return ctx && ctx.webpackWatching != null && typeof ctx.webpackWatching.resume === 'function'\n}\n\nif (!hasWebpackWatching(context)) {\n  throw new Error('Cannot recompile: webpack watcher not initialized. Restart gatsby develop.')\n}","tryCatchPattern":null,"preventionTips":["This is an internal invariant -- restart gatsby develop if encountered.","Report persistent occurrences as bugs.","Avoid calling internal recompile functions directly."],"tags":["webpack","develop","internal","state-machine","hot-reload"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}