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

  1. Move the configuration into the target specifier: `ng run my-app:build:production`.
  2. Remove the --configuration flag entirely if the default configuration is desired.
  3. 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

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


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