{"record":{"id":"312e412611647dfd","repo":"angular/angular-cli","slug":"unknown-schematics-built-in-module-id-request","errorCode":null,"errorMessage":"Unknown schematics built-in module '${id}' requested from schematic '${schematicFile}'","messagePattern":"Unknown schematics built-in module '(.+?)' requested from schematic '(.+?)'","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/angular/cli/src/command-builder/utilities/schematic-engine-host.ts","lineNumber":154,"sourceCode":"function wrap(\n  schematicFile: string,\n  schematicDirectory: string,\n  moduleCache: Map<string, unknown>,\n  exportName?: string,\n): () => unknown {\n  const hostRequire = createRequire(__filename);\n  const schematicRequire = createRequire(schematicFile);\n\n  const customRequire = function (id: string) {\n    if (legacyModules[id]) {\n      // Provide compatibility modules for older versions of @angular/cdk\n      return legacyModules[id];\n    } else if (id.startsWith('schematics:')) {\n      // Schematics built-in modules use the `schematics` scheme (similar to the Node.js `node` scheme)\n      const builtinId = id.slice(11);\n      const builtinModule = loadBuiltinModule(builtinId);\n      if (!builtinModule) {\n        throw new Error(\n          `Unknown schematics built-in module '${id}' requested from schematic '${schematicFile}'`,\n        );\n      }\n\n      return builtinModule;\n    } else if (id.startsWith('@angular-devkit/') || id.startsWith('@schematics/')) {\n      // Files should not redirect `@angular/core` and instead use the direct\n      // dependency if available. This allows old major version migrations to continue to function\n      // even though the latest major version may have breaking changes in `@angular/core`.\n      if (id.startsWith('@angular-devkit/core')) {\n        try {\n          return schematicRequire(id);\n        } catch (e) {\n          assertIsError(e);\n          if (e.code !== 'MODULE_NOT_FOUND') {\n            throw e;\n          }\n        }","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular/cli/src/command-builder/utilities/schematic-engine-host.ts#L136-L172","documentation":"customRequire in SchematicEngineHost resolves special module ids requested by schematics. Ids starting with 'schematics:' refer to schematics built-in modules resolved via loadBuiltinModule. When the requested builtin id is not registered, the engine throws 'Unknown schematics built-in module'. This guards against schematics importing modules the host does not provide.","triggerScenarios":"A schematic source file contains a dynamic or static import of 'schematics:<something>' where <something> is not one of the builtins exposed by loadBuiltinModule — e.g. a typo like require('schematics:utility/help') or an import of a builtin that was removed in the current CLI version.","commonSituations":"Third-party or hand-written schematics importing 'schematics:...' paths that worked in older Angular CLI versions but whose builtin mapping changed; typos in the module path; copying internal code that used non-public 'schematics:' imports.","solutions":["Correct the import path to a supported builtin (e.g. '@schematics/angular/utility/...' as a normal npm module import instead of 'schematics:...').","Check the CLI version's SchematicEngineHost/loadBuiltinModule to see which 'schematics:' ids are supported, and pin the CLI version the schematic was written for.","If you own the schematic, replace 'schematics:xyz' imports with direct imports from published packages like '@schematics/angular' or '@angular-devkit/schematics'.","Report/upgrade the third-party schematic package to a release compatible with your Angular CLI."],"exampleFix":"// before (in schematic source)\nconst { getWorkspace } = require('schematics:utility/config');\n\n// after\nimport { getWorkspace } from '@schematics/angular/utility/config';","handlingStrategy":"validation","validationCode":"const SUPPORTED_BUILTINS = new Set(['@angular-devkit/core', /* ids exposed by loadBuiltinModule */]);\nfunction isKnownBuiltin(id: string): boolean {\n  return id.startsWith('schematics:') && SUPPORTED_BUILTINS.has(id.slice(11));\n}\nif (!isKnownBuiltin(moduleId)) {\n  throw new Error(`Unsupported schematics: import '${moduleId}'; import from a published package instead`);\n}","typeGuard":"function isSchematicsBuiltinId(id: string): id is `schematics:${string}` {\n  return typeof id === 'string' && id.startsWith('schematics:');\n}","tryCatchPattern":"try {\n  require(moduleId);\n} catch (e) {\n  if (String(e.message).includes('Unknown schematics built-in module')) {\n    console.error(`Replace '${moduleId}' with a normal import from @schematics/angular or @angular-devkit/*`);\n  } else { throw e; }\n}","preventionTips":["Never import 'schematics:...' paths in your own schematics; they are internal host shims.","Prefer published imports: @angular-devkit/schematics, @schematics/angular.","Test schematics against the CLI versions you support in CI.","Pin the Angular CLI version in projects consuming third-party schematics."],"tags":["angular-cli","schematics","module-resolution","builtin-module"],"backgroundTag":"unknown-builtin-module","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}