angular/angular-cli · error · UnknownCollectionException

Unknown collection "${name}".

Error message

Unknown collection "${name}".

What it means

FallbackEngineHost tries each registered fallback collection host to resolve a collection by name; if every host fails to create a description, it throws UnknownCollectionException. It means no fallback host could locate a collection with that name.

Source

Thrown at packages/angular_devkit/schematics/tools/fallback-engine-host.ts:60

  addHost<CollectionT extends object, SchematicT extends object>(
    host: EngineHost<CollectionT, SchematicT>,
  ): void {
    this._hosts.push(host);
  }

  createCollectionDescription(
    name: string,
    requester?: CollectionDescription<{}>,
  ): CollectionDescription<FallbackCollectionDescription> {
    for (const host of this._hosts) {
      try {
        const description = host.createCollectionDescription(name, requester);

        return { name, host, description };
      } catch (_) {}
    }

    throw new UnknownCollectionException(name);
  }

  createSchematicDescription(
    name: string,
    collection: CollectionDescription<FallbackCollectionDescription>,
  ): SchematicDescription<FallbackCollectionDescription, FallbackSchematicDescription> | null {
    const description = collection.host.createSchematicDescription(name, collection.description);
    if (!description) {
      return null;
    }

    return { name, collection, description };
  }

  getSchematicRuleFactory<OptionT extends object>(
    schematic: SchematicDescription<FallbackCollectionDescription, FallbackSchematicDescription>,
    collection: CollectionDescription<FallbackCollectionDescription>,
  ): RuleFactory<OptionT> {

View on GitHub (pinned to bb72145f9a)

Solutions

  1. Install the collection package (npm i -D @schematics/<name> or the specific package)
  2. Check the collection name spelling and casing in the execute() call
  3. Verify the package exports a valid collection.json (check its package.json 'schematics' field)
  4. If a package exists but its description creation failed (swallowed by the catch), inspect its collection.json for corruption or schema mismatch

Example fix

// before
await workflow.execute({ collection: '@schematics/anguler', schematic: 'component' }); // typo, not installed
// after
// npm install --save-dev @schematics/angular
await workflow.execute({ collection: '@schematics/angular', schematic: 'component' });
Defensive patterns

Strategy: try-catch

Validate before calling

import { resolve } from 'path';
function collectionIsAvailable(name: string): boolean {
  try {
    require.resolve(`${name}/collection.json`);
    return true;
  } catch { return false; }
}

Try / catch

try {
  await workflow.execute({ collection: name, schematic: schematicName });
} catch (e) {
  if (/Unknown collection/.test(String(e))) {
    console.error(`Collection "${name}" not found. Install it: npm i -D ${name}`);
    process.exitCode = 1;
  } else throw e;
}

Prevention

When it happens

Trigger: createCollectionDescription(name) with a collection name that isn't resolvable by any fallback host — not installed in node_modules, not a built-in, wrong name/case, or a broken package whose own resolution threw.

Common situations: Referencing a schematic collection that isn't a devDependency (e.g. '@schematics/x' not installed); typos in collection names; running custom schematics that reference internal/renamed collections after a version upgrade.

Related errors


AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30). Data as JSON: /api/errors/6f6e60a2fee9d28e. Report an issue: GitHub.