angular/angular-cli · error · CommandModuleError
Unknown argument: configuration. Provide the configuration a
Error message
Unknown argument: configuration.
Provide the configuration as part of the target 'ng run ${targetWithConfig.join(':')}'. What it means
The 'ng run' command builder rejects the deprecated standalone --configuration argument when it is combined with a --target value. Configuration must be encoded in the target specifier itself (project:target:configuration), so passing --configuration is no longer valid.
Source
Thrown at packages/angular/cli/src/commands/run/cli.ts:56
const localYargs: Argv<RunCommandArgs> = argv
.positional('target', {
describe:
'The Architect target to run provided in the following format `project:target[:configuration]`.',
type: 'string',
demandOption: true,
// Show only in when using --help and auto completion because otherwise comma seperated configuration values will be invalid.
// Also, hide choices from JSON help so that we don't display them in AIO.
choices: (getYargsCompletions || help) && !jsonHelp ? this.getTargetChoices() : undefined,
})
.middleware((args) => {
// TODO: remove in version 15.
const { configuration, target } = args;
if (typeof configuration === 'string' && target) {
const targetWithConfig = target.split(':', 2);
targetWithConfig.push(configuration);
throw new CommandModuleError(
'Unknown argument: configuration.\n' +
`Provide the configuration as part of the target 'ng run ${targetWithConfig.join(
':',
)}'.`,
);
}
}, true)
.strict();
const target = this.makeTargetSpecifier();
if (!target) {
return localYargs;
}
const schemaOptions = await this.getArchitectTargetOptions(target);
return this.addSchemaOptionsToCommand(localYargs, schemaOptions);
}View on GitHub (pinned to bb72145f9a)
Solutions
- Move the configuration into the target specifier: `ng run my-app:build:production`.
- Remove the --configuration flag entirely if the default configuration is desired.
- Update scripts/docs to the modern `ng run <project>:<target>[:<config>]` syntax.
Example fix
// before ng run my-app:build --configuration production // after ng run my-app:build:production
Defensive patterns
Strategy: validation
Validate before calling
if (args.configuration && args.target) {
throw new Error(`Use 'ng run ${args.target.split(':')[0]}:${args.target.split(':')[1]}:${args.configuration}' instead of --configuration`);
} Type guard
type TargetSpecifier = `${string}:${string}` | `${string}:${string}:${string}`;
function isTargetSpecifier(v: string): v is TargetSpecifier {
return /^[^:]+:[^:]+(:[^:]+)?$/.test(v);
} Prevention
- Use `ng run project:target:configuration` syntax exclusively.
- Grep CI scripts for '--configuration' combined with 'ng run'.
- Prefer `ng build --configuration X` (without ng run) when config-only override is needed.
When it happens
Trigger: Running `ng run my-app:build --configuration production` (or programmatic equivalent) with both 'target' and 'configuration' string args; the builder detects the combination and throws a CommandModuleError.
Common situations: Scripts or CI configs written for old Angular CLI versions (pre-target-specifier syntax) migrated forward; muscle-memory use of `ng build --configuration` style flags with `ng run`.
Related errors
- Cannot determine project or target.
- Project '${projectName}' not found in workspace path ${works
- No project name provided and no default project found in wor
- Repository is not clean. Please commit or stash any changes
- A single package must be specified when using the 'migrate-o
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/e86c716bd99f5220.
Report an issue: GitHub.