angular/angular-cli · error · UnregisteredTaskException
Unregistered task "${name}"${addendum}.
Error message
Unregistered task "${name}"${addendum}. What it means
When a schematic schedules a post-execution task via context.addTask(...), the engine verifies that a task executor was registered for the task's name (host.hasTaskExecutor). If no executor with that name is registered on the engine host, the task could never actually run, so UnregisteredTaskException is thrown naming the missing executor and the schematic that requested it. This keeps schematics from silently scheduling no-op work.
Source
Thrown at packages/angular_devkit/schematics/src/engine/engine.ts:287
};
const maybeNewContext = this._host.transformContext(context);
if (maybeNewContext) {
context = maybeNewContext;
}
const taskScheduler = new TaskScheduler(context);
const host = this._host;
this._taskSchedulers.push(taskScheduler);
function addTask<T extends object>(
task: TaskConfigurationGenerator<T>,
dependencies?: Array<TaskId>,
): TaskId {
const config = task.toConfiguration();
if (!host.hasTaskExecutor(config.name)) {
throw new UnregisteredTaskException(config.name, schematic.description);
}
config.dependencies = config.dependencies || [];
if (dependencies) {
config.dependencies.unshift(...dependencies);
}
return taskScheduler.schedule(config);
}
return context;
}
createSchematic(
name: string,
collection: Collection<CollectionT, SchematicT>,
allowPrivate = false,
): Schematic<CollectionT, SchematicT> {View on GitHub (pinned to bb72145f9a)
Solutions
- Register the missing executor on the engine host before running schematics, e.g. host.registerTaskExecutor(NodePackageInstallTaskExecutor) (or the executor matching the task name in the message).
- Check the task name in the error against your schematic's addTask call — fix a typo or outdated task class import.
- If using Angular CLI tooling, build your host with the standard executors rather than a bare HostTree-based engine host.
- As a last resort in test code, stub/replace the task generator so no unregistered task is scheduled.
Example fix
// before
const engine = new SchematicEngine(new HostTreeEngineHost(hostTree));
// schematic: return context.addTask(new NodePackageInstallTask()); // throws: Unregistered task "node-package"
// after
import { NodePackageInstallTaskExecutor } from '@angular-devkit/schematics/tasks/node-package/executor';
host.registerTaskExecutor(NodePackageInstallTaskExecutor);
const engine = new SchematicEngine(new HostTreeEngineHost(hostTree)); Defensive patterns
Strategy: validation
Validate before calling
function assertTaskExecutorRegistered(host: SchematicEngineHost, generator: { toConfiguration(): { name: string } }): void {
const taskName = generator.toConfiguration().name;
if (!host.hasTaskExecutor(taskName)) {
throw new Error(`Register executor for task "${taskName}" before running schematics.`);
}
} Try / catch
import { UnregisteredTaskException } from '@angular-devkit/schematics';
try {
return context.addTask(new NodePackageInstallTask());
} catch (e) {
if (e instanceof UnregisteredTaskException) {
// register the executor named in e.message on the engine host
} else { throw e; }
} Prevention
- Always register the standard executors (NodePackageInstallTaskExecutor, RepositoryInitializerTaskExecutor, etc.) on custom engine hosts.
- Keep the task class and its executor imported from the same package version.
- Add an integration test that runs every schematic end-to-end so unregistered tasks fail in CI, not in users' builds.
When it happens
Trigger: Calling context.addTask(new SomeTaskGenerator(...), deps) inside a schematic rule where addTask's task.toConfiguration().name has no matching executor registered via host.registerTaskExecutor (e.g. addTask(new NodePackageInstallTask()) while the engine host was created without the NodePackageInstallTaskExecutor).
Common situations: Custom test harnesses or programmatic engine setups that omit standard executors (package install, RepositoryInitializer/initial-git-commit, TslintFix, RunSchematic) that the Angular CLI registers by default; renaming a task in a custom executor without updating the schematic that schedules it; version drift where a schematic schedules a task whose executor moved to another package.
Related errors
- Unknown package manager "${options.packageManager}".
- 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/57df53e9829d32f5.
Report an issue: GitHub.