angular/angular-cli · error · Error
Server asset '${path}' does not exist.
Error message
Server asset '${path}' does not exist. What it means
The asset manifest loaded by the server does not contain an entry for the requested path. getServerAsset is the lookup API for server assets (e.g. index.html) and throws when the path is absent from this.manifest.assets.
Source
Thrown at packages/angular/ssr/src/assets.ts:32
export class ServerAssets {
/**
* Creates an instance of ServerAsset.
*
* @param manifest - The manifest containing the server assets.
*/
constructor(private readonly manifest: AngularAppManifest) {}
/**
* Retrieves the content of a server-side asset using its path.
*
* @param path - The path to the server asset within the manifest.
* @returns The server asset associated with the provided path, as a `ServerAsset` object.
* @throws Error - Throws an error if the asset does not exist.
*/
getServerAsset(path: string): ServerAsset {
const asset = this.manifest.assets[path];
if (!asset) {
throw new Error(`Server asset '${path}' does not exist.`);
}
return asset;
}
/**
* Checks if a specific server-side asset exists.
*
* @param path - The path to the server asset.
* @returns A boolean indicating whether the asset exists.
*/
hasServerAsset(path: string): boolean {
return !!this.manifest.assets[path];
}
/**
* Retrieves the asset for 'index.server.html'.
*View on GitHub (pinned to bb72145f9a)
Solutions
- Rebuild both client and server bundles with @angular/build:application so the manifest includes the asset
- Ensure the served directory is the correct dist/<project> output and assets weren't deleted
- Check the requested path spelling matches files emitted to the browser/server output
- If loading a custom asset, add it to the build options 'assets' array
Example fix
// before
const asset = serverAssets.getServerAsset('index.dev.html');
// after
const asset = serverAssets.getServerAsset('index.html'); Defensive patterns
Strategy: try-catch
Validate before calling
const paths = serverAssets.getAvailablePaths();
if (!paths.includes('index.html')) {
throw new Error('index.html missing from server assets; rebuild the app');
} Try / catch
try {
const asset = serverAssets.getServerAsset(path);
} catch (e) {
if (e instanceof Error && e.message.includes('does not exist')) {
console.error(`Asset ${path} missing; rebuild with @angular/build:application`);
}
throw e;
} Prevention
- Always deploy the full dist folder produced by one build, never mix old/new assets
- List custom assets in the builder options so they land in the manifest
- Use getAvailablePaths() to verify expected assets before serving
When it happens
Trigger: Requesting getServerAsset('index.html') (or another path) when the server bundle was built without that asset emitted, wrong output path, or serving stale server bundles after a rebuild changed asset names.
Common situations: Server deployed with old dist folder while client assets were replaced, custom asset paths not listed in the builder options, running the server bundle directly (node dist/.../server.mjs) outside the built output context.
Related errors
- Angular app manifest is not set. Please ensure you are using
- Angular app engine manifest is not set. Please ensure you ar
- Error(s) occurred while extracting routes:\n${errors.map((er
- *
- Rendering failed with ${numErrors} worker errors.
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/a76ea2073dfcb734.
Report an issue: GitHub.