angular/angular-cli · error
A builder is not set for target '${target}' in project '${pr
Error message
A builder is not set for target '${target}' in project '${project}'. What it means
Once the target is found, `findProjectTarget` requires `targetDefinition.builder` to be set, since the architect host must resolve a builder implementation. This throws when a target exists in angular.json but has no `builder` property (or an empty one), which can only happen with hand-edited or programmatically built workspace definitions.
Source
Thrown at packages/angular_devkit/architect/node/node-modules-architect-host.ts:59
}
function findProjectTarget(
workspace: workspaces.WorkspaceDefinition,
project: string,
target: string,
): workspaces.TargetDefinition {
const projectDefinition = workspace.projects.get(project);
if (!projectDefinition) {
throw new Error(`Project "${project}" does not exist.`);
}
const targetDefinition = projectDefinition.targets.get(target);
if (!targetDefinition) {
throw new Error('Project target does not exist.');
}
if (!targetDefinition.builder) {
throw new Error(`A builder is not set for target '${target}' in project '${project}'.`);
}
return targetDefinition;
}
export class WorkspaceNodeModulesArchitectHost implements ArchitectHost<NodeModulesBuilderInfo> {
private workspaceHost: WorkspaceHost;
constructor(workspaceHost: WorkspaceHost, _root: string);
constructor(workspace: workspaces.WorkspaceDefinition, _root: string);
constructor(
workspaceOrHost: workspaces.WorkspaceDefinition | WorkspaceHost,
protected _root: string,
) {
if ('getBuilderName' in workspaceOrHost) {
this.workspaceHost = workspaceOrHost;View on GitHub (pinned to bb72145f9a)
Solutions
- Add the `builder` property to the target in angular.json (e.g. `"builder": "@angular-devkit/build-angular:application"`).
- Restore the target block from version control or regenerate it with `ng generate` / `ng add` of the relevant package.
- Install the package providing the builder if the field references a missing dependency (also check spelling of the builder string).
- In programmatic use, set `targets.set(name, { builder, ... })` before invoking the architect host.
Example fix
// before
"my-target": {
"options": {}
}
// after
"my-target": {
"builder": "@angular-devkit/build-angular:application",
"options": {}
} Defensive patterns
Strategy: validation
Validate before calling
const cfg = JSON.parse(fs.readFileSync('angular.json', 'utf8'));
for (const [name, t] of Object.entries<any>(cfg.projects?.[project]?.architect ?? {})) {
if (!t.builder) throw new Error(`Target "${name}" in project "${project}" is missing "builder".`);
} Type guard
function hasBuilder(t: unknown): t is { builder: string; options?: object } {
return typeof t === 'object' && t !== null && typeof (t as any).builder === 'string' && (t as any).builder.length > 0;
} Try / catch
try {
await architect.schedule(target, options, context);
} catch (e) {
if ((e as Error).message.includes('A builder is not set for target')) {
console.error('Add a "builder" field to the angular.json target:', (e as Error).message);
} else { throw e; }
} Prevention
- Never hand-edit angular.json without a schema-aware editor (IDE JSON schema validation catches this).
- Copy-paste complete target blocks including the builder line.
- Reinstall the builder package (`ng add`) after major upgrades to restore default target definitions.
When it happens
Trigger: angular.json contains a target object missing the `builder` key, e.g. `{ "my-target": { "options": {} } }` with no `"builder": "@angular-devkit/build-angular:..."` string; or code constructing TargetDefinition without a builder.
Common situations: Manual edits to angular.json; partial copy-paste of target blocks; migration tools stripping builder fields; custom schematic output that omits builder; renaming a builder package without updating the field.
Related errors
- Project "${project}" does not exist.
- Project target does not exist.
- Cannot determine project for command. This is a multi-projec
- The builder requires a target.
- Could not find ${level} workspace.
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/6513693039253f9c.
Report an issue: GitHub.