angular/angular-cli · error · Error
Unknown error occurred processing bundle for "${path}".
Error message
Unknown error occurred processing bundle for "${path}". What it means
During the esbuild-based bundling of an Angular application, the transform result for a bundle (e.g. a chunk or locale data file) came back null/undefined or with no code. The devkit treats this as an unrecoverable, unexpected failure of the bundler rather than a user-facing build error, so it throws this generic message. It almost always indicates the esbuild transform pipeline itself failed silently (native binary mismatch, crash, or resource issue) rather than a problem in your source code.
Source
Thrown at packages/angular_devkit/build_angular/src/utils/process-bundle.ts:399
// eslint-disable-next-line @typescript-eslint/no-explicit-any
inputSourceMap: false as any,
babelrc: false,
configFile: false,
presets: [
[
require.resolve('@babel/preset-env'),
{
targets: { esmodules: true },
},
],
],
minified: allowMinify && optimize,
compact: !shouldBeautify && optimize,
comments: !optimize,
});
if (!transformResult || !transformResult.code) {
throw new Error(`Unknown error occurred processing bundle for "${path}".`);
}
return transformResult.code;
}
View on GitHub (pinned to bb72145f9a)
Solutions
- Delete node_modules and lockfile, reinstall (npm ci) so the correct @esbuild/<platform> binary is installed
- Clear the Angular CLI cache (rm -rf .angular/cache)
- Verify your Node version is in the supported range for your @angular-devkit/build_angular version and upgrade @angular-devkit/build_angular
- If building in Docker, ensure the build stage runs on the same platform as the installed esbuild binary; avoid copying node_modules across platforms
Example fix
# before (broken install) node_modules/@esbuild/linux-x64/bin/esbuild # missing or wrong arch # after rm -rf node_modules package-lock.json npm install
Defensive patterns
Strategy: try-catch
Validate before calling
import { existsSync } from 'fs';
const esbuildBin = require.resolve('esbuild');
if (!existsSync(esbuildBin)) throw new Error('esbuild missing; reinstall node_modules');
// Also verify the platform binary:
try { require('@esbuild/linux-x64'); } catch { throw new Error('Platform esbuild binary missing; run npm ci'); } Type guard
function hasCode(r: { code?: string } | null | undefined): r is { code: string } {
return !!r && typeof r.code === 'string' && r.code.length > 0;
} Try / catch
try {
await build(options);
} catch (e) {
if (e instanceof Error && e.message.includes('Unknown error occurred processing bundle')) {
// reinstall node_modules, clear .angular/cache, retry once
}
throw e;
} Prevention
- Run npm ci (not incremental installs) when switching Node versions or platforms
- Pin the exact @angular-devkit/build_angular and esbuild versions across the team and CI
- Clear .angular/cache after upgrading tooling
- Give CI builds adequate memory (esbuild can OOM on large bundles)
When it happens
Trigger: loadLocaleData/inlineLocales call process-bundle's transform path and esbuild's transform returns an empty result: corrupted or platform-mismatched esbuild native binary, esbuild crashing (OOM, unsupported platform), or a transform invoked with options that produce no output.
Common situations: Corrupted node_modules after switching Node versions or platforms (e.g. Docker image built on different arch), running out of memory during large builds, npm/yarn optional-dependency install bugs that skip the platform-specific @esbuild/* binary, stale Angular CLI cache.
Related errors
- esbuild implementation missing
- The 'vendorChunk' option is not used by this builder and wil
- The 'commonChunk' option is always enabled by this builder a
- The 'webWorkerTsConfig' option is not yet supported by this
- Could not find ${level} workspace.
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/fd278e956ace96f4.
Report an issue: GitHub.