{"record":{"id":"2a75f0c0abdab178","repo":"angular/angular-cli","slug":"webpack-stats-build-result-is-required-2a75f0","errorCode":null,"errorMessage":"Webpack stats build result is required.","messagePattern":"Webpack stats build result is required\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/angular_devkit/build_angular/src/builders/server/index.ts","lineNumber":94,"sourceCode":"\n  const baseOutputPath = path.resolve(root, options.outputPath);\n  let outputPaths: undefined | Map<string, string>;\n\n  return from(initialize(options, context, transforms.webpackConfiguration)).pipe(\n    concatMap(({ config, i18n, projectRoot, projectSourceRoot }) => {\n      return runWebpack(config, context, {\n        webpackFactory: require('webpack') as typeof webpack,\n        logging: (stats, config) => {\n          if (options.verbose && config.stats !== false) {\n            const statsOptions = config.stats === true ? undefined : config.stats;\n            context.logger.info(stats.toString(statsOptions));\n          }\n        },\n      }).pipe(\n        concatMap(async (output) => {\n          const { emittedFiles = [], outputPath, webpackStats, success } = output;\n          if (!webpackStats) {\n            throw new Error('Webpack stats build result is required.');\n          }\n\n          if (!success) {\n            if (statsHasWarnings(webpackStats)) {\n              context.logger.warn(statsWarningsToString(webpackStats, { colors: true }));\n            }\n            if (statsHasErrors(webpackStats)) {\n              context.logger.error(statsErrorsToString(webpackStats, { colors: true }));\n            }\n\n            return output;\n          }\n\n          const spinner = new Spinner();\n          spinner.enabled = options.progress !== false;\n          outputPaths = ensureOutputPaths(baseOutputPath, i18n);\n\n          // Copy assets","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular_devkit/build_angular/src/builders/server/index.ts#L76-L112","documentation":"The server builder subscribes to webpack build events and destructures `webpackStats` from each emitted output. If a build event arrives without webpack stats, the builder cannot produce a meaningful result and throws this error. It is an internal invariant check: every completed webpack compilation must carry stats.","triggerScenarios":"Running `ng run <project>:server` when the underlying webpack builder emits an output event where `output.webpackStats` is undefined — typically from a misbehaving custom webpack plugin, an incompatible builder/plugin version, or a build event emitted before compilation stats exist.","commonSituations":"Using third-party webpack plugins (or custom builders extending the server builder) that emit build results without stats; version mismatches between @angular-devkit/build-angular and custom tooling; builder harness/test setups feeding incomplete build results.","solutions":["Remove or update custom webpack plugins/builder wrappers until the build emits proper webpack stats.","Align @angular-devkit/build-angular and related @angular/* package versions (all from the same major/minor release).","Reproduce with a minimal config (no custom webpack extras) to isolate the plugin that drops stats.","Check for a merged/incompatible builder (e.g. custom execute implementations) and ensure it forwards webpackStats in its results."],"exampleFix":"// custom builder result missing stats\nreturn { success, outputPath, emittedFiles };\n// after: include webpackStats from the webpack compilation\nreturn { success, outputPath, emittedFiles, webpackStats: compilationToStats(result) };","handlingStrategy":"try-catch","validationCode":"if (result && typeof result === 'object' && 'webpackStats' in result) { /* safe to use builder */ }","typeGuard":"function hasWebpackStats(r: unknown): r is { webpackStats: object; success: boolean; outputPath: string } {\n  return typeof r === 'object' && r !== null && 'webpackStats' in r && r.webpackStats != null;\n}","tryCatchPattern":"try {\n  await firstValueFrom(ngBuild(context, options));\n} catch (err) {\n  if (err instanceof Error && err.message.includes('Webpack stats build result is required.')) {\n    context.logger.error('A custom webpack plugin dropped build stats; disable custom plugins.');\n  }\n  throw err;\n}","preventionTips":["Avoid unvetted custom webpack plugins in the server build.","Keep @angular-devkit/build-angular and custom builders on compatible versions.","Test builder extensions emit full ArchitectBuilder results including webpackStats."],"tags":["angular","webpack","server","builder","invariant"],"backgroundTag":"missing-webpack-stats","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}