angular/angular-cli · error
Invalid builder name:
Error message
Invalid builder name:
What it means
scheduleBuilder expects a builder name in 'project:target[:configuration]' format (a target-style name). The regex ^[^:]+:[^:]+(:[^:]+)?$ enforces 2–3 colon-separated non-empty segments; anything else throws 'Invalid builder name: ...'.
Source
Thrown at packages/angular_devkit/architect/src/architect.ts:378
privateArchitectJobRegistry,
...(additionalJobRegistry ? [additionalJobRegistry] : []),
] as Registry[]);
this._scheduler = new SimpleScheduler(jobRegistry, registry);
}
has(name: JobName): Observable<boolean> {
return this._scheduler.has(name);
}
scheduleBuilder(
name: string,
options: json.JsonObject,
scheduleOptions: ScheduleOptions = {},
): Promise<BuilderRun> {
// The below will match 'project:target:configuration'
if (!/^[^:]+:[^:]+(:[^:]+)?$/.test(name)) {
throw new Error('Invalid builder name: ' + JSON.stringify(name));
}
return scheduleByName(name, options, {
scheduler: this._scheduler,
logger: scheduleOptions.logger || new logging.NullLogger(),
currentDirectory: this._host.getCurrentDirectory(),
workspaceRoot: this._host.getWorkspaceRoot(),
});
}
scheduleTarget(
target: Target,
overrides: json.JsonObject = {},
scheduleOptions: ScheduleOptions = {},
): Promise<BuilderRun> {
return scheduleByTarget(target, overrides, {
scheduler: this._scheduler,
logger: scheduleOptions.logger || new logging.NullLogger(),
currentDirectory: this._host.getCurrentDirectory(),View on GitHub (pinned to bb72145f9a)
Solutions
- Pass a target-qualified name like 'my-app:build:production' to scheduleBuilder
- If you only have a package builder name, use architect.scheduleTarget(targetFromTargetString(...)) or scheduleByName with the full name
- Strip whitespace and validate the 'a:b(:c)' shape before calling
- Check where the name string originates (config/env) for truncation or missing colons
Example fix
// before
architect.scheduleBuilder('@angular-devkit/build-angular:browser', options)
// after
architect.scheduleBuilder('my-app:build', options) Defensive patterns
Strategy: validation
Validate before calling
if (!/^[^:]+:[^:]+(:[^:]+)?$/.test(name)) {
throw new Error(`scheduleBuilder needs a target-style name (project:target[:config]), got: ${name}`);
} Type guard
function isScheduleableBuilderName(v) {
return typeof v === 'string' && /^[^:]+:[^:]+(:[^:]+)?$/.test(v);
} Try / catch
try {
const run = await architect.scheduleBuilder(name, options);
} catch (e) {
if (e.message.startsWith('Invalid builder name:')) {
console.error(`Use a project:target[:configuration] name, not a package:builder name: ${e.message}`);
}
throw e;
} Prevention
- Remember scheduleBuilder takes a TARGET name, scheduleTarget takes a Target object
- Validate the a:b(:c) shape before calling
- Avoid constructing names from env vars without sanitizing
- Use targetFromTargetString to normalize input first
When it happens
Trigger: Calling architect.scheduleBuilder(name, options) with a bare name like 'browser' or '@angular-devkit/build-angular:browser' (unqualified package:builder form is not valid here), or a string with empty segments like 'a::c'.
Common situations: See trigger scenarios.
Related errors
- Invalid target string:
- Package "${packageName}" has an invalid builder schema path:
- Builder is not a builder
- Cannot load builder for builderInfo ${JSON.stringify(info, n
- Invalid target: ${JSON.stringify(target)}.
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/b98f115e26dedf21.
Report an issue: GitHub.