angular/angular-cli · error · UnknownCollectionException
Unknown collection "${name}".
Error message
Unknown collection "${name}". What it means
When the engine builds a collection description it delegates to the host's createCollectionDescription; if the host cannot resolve the named collection it returns null and the engine throws UnknownCollectionException. Collections are resolved through registered collection hosts (e.g. node modules with a collection.json), so the name must match an installed, registered collection.
Source
Thrown at packages/angular_devkit/schematics/src/engine/engine.ts:218
}
const [description, bases] = this._createCollectionDescription(name, requester?.description);
collection = new CollectionImpl<CollectionT, SchematicT>(description, this, bases);
this._collectionCache.set(name, collection);
this._schematicCache.set(collection, new Map());
return collection;
}
private _createCollectionDescription(
name: string,
requester?: CollectionDescription<CollectionT>,
parentNames?: Set<string>,
): [CollectionDescription<CollectionT>, Array<CollectionDescription<CollectionT>>] {
const description = this._host.createCollectionDescription(name, requester);
if (!description) {
throw new UnknownCollectionException(name);
}
if (parentNames && parentNames.has(description.name)) {
throw new CircularCollectionException(name);
}
const bases = new Array<CollectionDescription<CollectionT>>();
if (description.extends) {
parentNames = (parentNames || new Set<string>()).add(description.name);
for (const baseName of description.extends) {
const [base, baseBases] = this._createCollectionDescription(
baseName,
description,
new Set(parentNames),
);
bases.unshift(base, ...baseBases);
}
}View on GitHub (pinned to bb72145f9a)
Solutions
- Install the collection package (e.g. `npm install --save-dev @schematics/angular`) and verify the exact name
- Check the package's package.json `schematics` field points at its collection.json
- Verify the custom collection host registers the collection before engine.execute
- Pin versions consistent with your Angular CLI to avoid renamed/moved collections
Example fix
// before
engine.createCollection('@angular/cdk/schematics'); // wrong name
// after
engine.createCollection('@angular/cdk'); // valid collection name, installed package Defensive patterns
Strategy: try-catch
Validate before calling
const name = '@schematics/angular';
try {
require.resolve(`${name}/collection.json`);
} catch {
throw new Error(`Collection "${name}" is not installed; run npm install --save-dev ${name}.`);
} Try / catch
import { UnknownCollectionException } from '@angular-devkit/schematics';
try {
engine.createCollection(name);
} catch (err) {
if (err instanceof UnknownCollectionException) {
console.error(`Collection "${name}" not found. Is the package installed and its collection.json resolvable?`);
} else throw err;
} Prevention
- Verify collection package names with npm ls / require.resolve before executing schematics
- Add required schematic collections (e.g. @schematics/angular) to devDependencies so CI installs them
- Confirm custom packages export collection.json via the package.json `schematics` field
- Keep CLI and schematic package versions aligned
When it happens
Trigger: executeSchematic / createCollection called with a collection name that no registered host can resolve — wrong name string, collection package not installed, or its collection.json missing/not exported by its package.json `schematics` field.
Common situations: Running `ng generate` with a mistyped or uninstalled schematic collection; a devDependency missing in CI; a renamed package between versions; referencing `@schematics/angular` variants that aren't installed in a bare project.
Related errors
- schematicName cannot be undefined.
- The "not" keyword is not supported in JSON Schema.
- Could not find (/.angular.json)
- Unknown schematics built-in module '${id}' requested from sc
- A collection and schematic is required during execution.
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/c7a288bb8ad8f42c.
Report an issue: GitHub.