angular/angular-cli · error · SchematicMissingFieldsException
Schematic "${name}" is missing fields.
Error message
Schematic "${name}" is missing fields. What it means
Thrown by _transformSchematicDescription when a schematic's resolved description lacks required fields: factoryFn, path, or description. After resolving the factory reference, these three fields must all be populated for the schematic to run.
Source
Thrown at packages/angular_devkit/schematics/tools/file-system-engine-host.ts:84
desc: Partial<FileSystemCollectionDesc>,
): FileSystemCollectionDesc {
if (!desc.schematics || typeof desc.schematics != 'object') {
throw new CollectionMissingSchematicsMapException(name);
}
return {
...desc,
name,
} as FileSystemCollectionDesc;
}
protected _transformSchematicDescription(
name: string,
_collection: FileSystemCollectionDesc,
desc: Partial<FileSystemSchematicDesc>,
): FileSystemSchematicDesc {
if (!desc.factoryFn || !desc.path || !desc.description) {
throw new SchematicMissingFieldsException(name);
}
return desc as FileSystemSchematicDesc;
}
override hasTaskExecutor(name: string): boolean {
if (super.hasTaskExecutor(name)) {
return true;
}
try {
const maybePath = require.resolve(join(this._root, name));
if (existsSync(maybePath)) {
return true;
}
} catch {}
return false;View on GitHub (pinned to bb72145f9a)
Solutions
- Add a `description` field to the schematic entry in collection.json.
- Verify the `factory` reference resolves to an existing file so `path` and `factoryFn` get populated.
- If subclassing the host, ensure the partial description passed to _transformSchematicDescription includes factoryFn, path, and description.
Example fix
// before (collection.json)
"my-schematic": { "factory": "./index#run" }
// after
"my-schematic": { "factory": "./index#run", "description": "Generates my thing" } Defensive patterns
Strategy: validation
Validate before calling
const coll = JSON.parse(readFileSync('collection.json', 'utf8'));
for (const [name, s] of Object.entries(coll.schematics)) {
if (!s.factory) throw new Error(`'${name}' missing factory`);
if (!s.description) throw new Error(`'${name}' missing description (required by FileSystemEngineHost)`);
} Try / catch
try {
const schematic = collection.createSchematic(name, true);
} catch (e) {
if (String(e.message).includes('is missing fields')) {
console.error("Add description (and verify factory resolves so path/factoryFn are set)");
} else throw e;
} Prevention
- Always include factory, description, and (when used) schema in every schematic entry.
- Validate collection.json against the official JSON schema in CI.
- Keep factory paths stable across refactors; add a load-all-schematics smoke test.
When it happens
Trigger: A collection.json schematic entry missing `description` while having a factory (factoryFn and path come from resolution); or a factory module that resolves but the pipeline cannot derive path/description — `if (!desc.factoryFn || !desc.path || !desc.description)` triggers.
Common situations: Minimal hand-written collection.json entries that omit `description`; factory files that were moved so `path` cannot be derived; partially-filled schematic objects in custom engine subclasses calling _transformSchematicDescription with incomplete partials.
Related errors
- Schematic ${JSON.stringify(name)} is missing a factory.
- Option "project" is required.
- Project is not defined in this workspace.
- Targets are not defined for this project.
- Circular collection reference "${name}".
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/c5b57c5473600840.
Report an issue: GitHub.