{"record":{"id":"b8e85733ae7acaab","repo":"angular/angular-cli","slug":"schematic-name-not-found-in-collection-col","errorCode":null,"errorMessage":"Schematic \"${name}\" not found in collection \"${collection.name}\".","messagePattern":"Schematic \"(.+?)\" not found in collection \"(.+?)\"\\.","errorType":"exception","errorClass":"UnknownSchematicException","httpStatus":null,"severity":"error","filePath":"packages/angular_devkit/schematics/src/engine/engine.ts","lineNumber":327,"sourceCode":"    if (schematic) {\n      return schematic;\n    }\n\n    let collectionDescription = collection.description;\n    let description = this._host.createSchematicDescription(name, collection.description);\n    if (!description) {\n      if (collection.baseDescriptions) {\n        for (const base of collection.baseDescriptions) {\n          description = this._host.createSchematicDescription(name, base);\n          if (description) {\n            collectionDescription = base;\n            break;\n          }\n        }\n      }\n      if (!description) {\n        // Report the error for the top level schematic collection\n        throw new UnknownSchematicException(name, collection.description);\n      }\n    }\n\n    if (description.private && !allowPrivate) {\n      throw new PrivateSchematicException(name, collection.description);\n    }\n\n    const factory = this._host.getSchematicRuleFactory(description, collectionDescription);\n    schematic = new SchematicImpl<CollectionT, SchematicT>(description, factory, collection, this);\n\n    schematicMap?.set(name, schematic);\n\n    return schematic;\n  }\n\n  listSchematicNames(\n    collection: Collection<CollectionT, SchematicT>,\n    includeHidden?: boolean,","sourceCodeStart":309,"sourceCodeEnd":345,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular_devkit/schematics/src/engine/engine.ts#L309-L345","documentation":"SchematicEngine.createSchematic looks up the schematic description in the given collection, and if not found there, walks the collection's base (extends) descriptions before giving up. When the name resolves nowhere, UnknownSchematicException is thrown reporting the requested schematic name and the top-level collection that was searched. The engine surfaces the top-level collection in the message because extends chains are an implementation detail of the lookup.","triggerScenarios":"engine.createSchematic(name, collection) where neither the collection nor any of its baseDescriptions exports a schematic named \"name\" — e.g. calling collection.createSchematic('component-x') when collection.json has no such entry, a mistyped schematic name, or the schematic lives in a different collection than the one passed in.","commonSituations":"Typos in schematic names when invoking schematics programmatically (ng generate with a wrong name produces the same class of failure); running a schematic from a custom collection that was renamed or removed; passing the wrong Collection object to createSchematic; a collection.json that failed to declare the schematic despite its factory file existing.","solutions":["Verify the schematic name exists in the target collection's collection.json \"schematics\" map (or run the equivalent list command, e.g. ng generate --list-schematics).","Correct the name/typo in the createSchematic (or ng generate) call.","Point createSchematic at the collection that actually defines the schematic, or add the schematic entry (name -> factory path) to collection.json.","If the schematic should come from a base collection, add it to this collection's \"extends\" so the base lookup succeeds."],"exampleFix":"// before\nconst collection = engine.createCollection('my-collection');\nconst schematic = collection.createSchematic('componnt'); // typo\n\n// after\nconst collection = engine.createCollection('my-collection');\nconst schematic = collection.createSchematic('component');","handlingStrategy":"validation","validationCode":"import * as fs from 'fs';\nfunction collectionHasSchematic(collectionJsonPath: string, name: string): boolean {\n  const json = JSON.parse(fs.readFileSync(collectionJsonPath, 'utf8'));\n  return !!json.schematics && Object.prototype.hasOwnProperty.call(json.schematics, name);\n}\nif (!collectionHasSchematic('node_modules/my-collection/collection.json', 'component')) {\n  throw new Error('Schematic \"component\" does not exist in my-collection');\n}","typeGuard":"function isKnownSchematic(name: string, collection: { listSchematicNames(includeHidden?: boolean): string[] }): boolean {\n  return collection.listSchematicNames(true).includes(name);\n}","tryCatchPattern":"import { UnknownSchematicException } from '@angular-devkit/schematics';\ntry {\n  const schematic = collection.createSchematic(name);\n} catch (e) {\n  if (e instanceof UnknownSchematicException) {\n    const available = collection.listSchematicNames();\n    throw new Error(`Unknown schematic \"${name}\". Available: ${available.join(', ')}`);\n  } else { throw e; }\n}","preventionTips":["Check names with collection.listSchematicNames() (or the CLI list output) before invoking programmatically.","Keep schematic names in constants/enums instead of free-form strings in tooling code.","Ensure every factory file referenced in your collection.json has a matching entry, and run a smoke test per schematic in CI."],"tags":["schematics","not-found","configuration","collection"],"backgroundTag":"schematic-not-found","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}