{"record":{"id":"e27c18632859935b","repo":"gatsbyjs/gatsby","slug":"error-when-closing-workerpool-e-message","errorCode":null,"errorMessage":"Error when closing WorkerPool: ${e.message}","messagePattern":"Error when closing WorkerPool: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby/src/commands/build.ts","lineNumber":569,"sourceCode":"\n  const postBuildActivityTimer = report.activityTimer(`onPostBuild`, {\n    parentSpan: buildSpan,\n  })\n  postBuildActivityTimer.start()\n  await apiRunnerNode(`onPostBuild`, {\n    graphql: gatsbyNodeGraphQLFunction,\n    parentSpan: postBuildActivityTimer.span,\n  })\n  postBuildActivityTimer.end()\n\n  // Wait for any jobs that were started in onPostBuild\n  // This could occur due to queries being run which invoke sharp for instance\n  await waitUntilAllJobsComplete()\n\n  try {\n    await waitWorkerPoolEnd\n  } catch (e) {\n    report.warn(`Error when closing WorkerPool: ${e.message}`)\n  }\n\n  // Make sure we saved the latest state so we have all jobs cached\n  await db.saveState()\n\n  const state = store.getState()\n  reporter._renderPageTree({\n    components: state.components,\n    functions: state.functions,\n    pages: state.pages,\n    root: state.program.directory,\n  })\n\n  if (process.send) {\n    const gatsbyCloudConfig = constructConfigObject(state.config)\n\n    process.send({\n      type: `LOG_ACTION`,","sourceCodeStart":551,"sourceCodeEnd":587,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/e85d62f1779e353eaac1753211629a26d123e26c/packages/gatsby/src/commands/build.ts#L551-L587","documentation":"At the end of gatsby build, after onPostBuild hooks, the worker pool termination promise (waitWorkerPoolEnd) is awaited in a try/catch. If shutting down worker threads fails (a worker crashed or hung), Gatsby logs this warning with the underlying error message but lets the build finish, since real work is already complete.","triggerScenarios":"Thrown at packages/gatsby/src/commands/build.ts:569 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the logged inner error for a worker crash (often OOM or a native module failure in sharp/jimp workers)","Retry the build; transient worker termination failures usually do not recur","Reduce parallelism or upgrade Node/native deps if workers repeatedly fail to exit"],"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"}