{"id":"d1a523d7a16a2030","repo":"webpack/webpack","slug":"failed-examples-failed","errorCode":null,"errorMessage":"${failed} examples failed","messagePattern":"(.+?) examples failed","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"examples/buildAll.js","lineNumber":28,"sourceCode":"\nlet failed = 0;\nlet i = 0;\n\nfor (const cmd of commands) {\n\tconsole.log(`[${++i}/${commands.length}] ${cmd}`);\n\n\ttry {\n\t\tcp.execSync(cmd, { encoding: \"utf8\" });\n\t} catch (err) {\n\t\tfailed++;\n\t\tconsole.log(err);\n\t}\n}\n\nconsole.log(\"done\");\n\nif (failed > 0) {\n\tthrow new Error(`${failed} examples failed`);\n}\n","sourceCodeStart":10,"sourceCodeEnd":30,"githubUrl":"https://github.com/webpack/webpack/blob/318421ea8ac81371f5171236a6efb63675576528/examples/buildAll.js#L10-L30","documentation":"examples/buildAll.js iterates every example directory and runs `node build.js` in each via child_process.execSync, catching per-example failures. After the loop it throws an aggregate error naming how many examples failed. The real failures are logged to stdout (the caught err objects) above this throw, so this error is the summary, not the root cause.","triggerScenarios":"Running `node examples/buildAll.js` (or the `yarn build:examples` pipeline) when one or more example builds exit non-zero — e.g. a snapshot mismatch, a core webpack change that alters emitted output, or a broken example config.","commonSituations":"A webpack core change that changes emitted stats/output shape breaks many examples at once; outdated snapshots after an intentional stats change; an example depending on a feature that was removed; flaky examples failing under memory pressure.","solutions":["Read the console output immediately above the throw — each failed example's full execSync error is printed there.","Reproduce the failing example in isolation: `cd examples/<name> && node build.js`.","Fix the root cause in the example config or webpack core, then re-run the whole pipeline.","If the failure is an expected stats/output change, regenerate example snapshots/expected output and re-run."],"exampleFix":"// before\nthrow new Error(`${failed} examples failed`);\n\n// after (diagnostic): surface which examples failed\nif (failed > 0) {\n  throw new Error(`${failed} examples failed: ${failedNames.join(', ')}`);\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// wrap each example build and record which failed, so the aggregate error is actionable\nconst failedNames = [];\nfor (const cmd of commands) {\n  try { cp.execSync(cmd, { encoding: 'utf8' }); }\n  catch (err) { failed++; failedNames.push(cmd); console.error(err); }\n}\nif (failed > 0) throw new Error(`${failed} examples failed: ${failedNames.join(', ')}`);","preventionTips":["Always inspect the per-example error printed above the aggregate throw.","Reproduce a failing example in isolation before debugging.","Keep example snapshots regenerated after intentional stats changes."],"tags":["examples","build","aggregation","ci"],"analyzedSha":"318421ea8ac81371f5171236a6efb63675576528","analyzedAt":"2026-08-03T19:39:56.731Z","schemaVersion":2}