angular/angular-cli · error · SchematicMissingFieldsException

Schematic " " is missing fields.

Error message

Schematic "${name}" is missing fields.

What it means

Thrown by _transformSchematicDescription in packages/angular_devkit/schematics/tools/node-module-engine-host.ts:138 when a schematic entry inside a collection's schematics map is missing required fields: factoryFn (resolvable factory), path (directory of the schematic), or description. The engine validates each schematic description before registering it, via SchematicMissingFieldsException.

Solutions

  1. Add the missing keys to the schematic's collection.json entry: at minimum "factory" (resolvable path), "description", and ensure the engine can derive "path" (the schematic folder).
  2. Verify the factory file exists in the published/built output and exports the factory function (e.g. exports function mySchematic(options): Rule).
  3. Fix the "factory" path — it must resolve relative to the schematic/collection location (e.g. "./my-schematic/index").
  4. Check tsconfig/build config excludes the factory file (often tsconfig excludes spec files but can also exclude generators).

Example fix

// before (collection.json entry)
"my-schematic": {}
// after
"my-schematic": {
  "factory": "./my-schematic/index#mySchematic",
  "description": "Generates a widget",
  "schema": "./my-schematic/schema.json"
}
Defensive patterns

Strategy: validation

Validate before calling

function validateSchematicEntries(collectionDesc) {
  for (const [name, entry] of Object.entries(collectionDesc.schematics)) {
    if (!entry.factory || !entry.description) {
      throw new Error(`schematic "${name}" needs "factory" and "description"`);
    }
  }
}

Type guard

function isCompleteSchematicDesc(desc) {
  return typeof desc === 'object' && desc !== null
    && typeof desc.factory === 'string'
    && typeof desc.description === 'string';
}

Try / catch

try {
  const schematic = collection.createSchematic(name);
} catch (err) {
  if (err instanceof SchematicMissingFieldsException) {
    console.error(`Schematic "${name}" entry in collection.json is incomplete`);
  } else { throw err; }
}

Prevention

When it happens

Trigger: A collection.json entry references a factory that fails to load (so factoryFn/path never populate), or the entry omits "factory"/"description" keys — e.g. { "my-schematic": {} } or an entry whose factory path doesn't resolve to a module exporting the schematic function.

Common situations: Typos or missing keys in hand-written collection.json; factory file not emitted by the build (factory path points to a .js that doesn't exist in dist); renamed a schematic factory but didn't update the collection entry; migrating collections between formats and dropping the "description" field.

Related errors


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

Appendix: source

Thrown at packages/angular_devkit/schematics/tools/node-module-engine-host.ts:138

    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;
  }
}

View on GitHub (pinned to bb72145f9a)