angular/angular-cli · error
Configuration '${configuration}' for target '${target}' in p
Error message
Configuration '${configuration}' for target '${target}' in project '${project}' is not set in the workspace. What it means
This error is thrown by the architect host's getOptionsForTarget when a named configuration (e.g. 'production') is requested for a target, but the target definition in angular.json has no entry under 'configurations' with that name. The workspace schema simply doesn't define that configuration for that project's target.
Source
Thrown at packages/angular_devkit/architect/node/node-modules-architect-host.ts:93
) {
if ('getBuilderName' in workspaceOrHost) {
this.workspaceHost = workspaceOrHost;
} else {
this.workspaceHost = {
async getBuilderName(project, target) {
const { builder } = findProjectTarget(workspaceOrHost, project, target);
return builder;
},
async getOptions(project, target, configuration) {
const targetDefinition = findProjectTarget(workspaceOrHost, project, target);
if (configuration === undefined) {
return (targetDefinition.options ?? {}) as json.JsonObject;
}
if (!targetDefinition.configurations?.[configuration]) {
throw new Error(
`Configuration '${configuration}' for target '${target}' in project '${project}' is not set in the workspace.`,
);
}
return (targetDefinition.configurations?.[configuration] ?? {}) as json.JsonObject;
},
async getMetadata(project) {
const projectDefinition = workspaceOrHost.projects.get(project);
if (!projectDefinition) {
throw new Error(`Project "${project}" does not exist.`);
}
return {
root: projectDefinition.root,
sourceRoot: projectDefinition.sourceRoot,
prefix: projectDefinition.prefix,
...(clone(workspaceOrHost.extensions) as {}),
...(clone(projectDefinition.extensions) as {}),View on GitHub (pinned to bb72145f9a)
Solutions
- Add the missing configuration under the target's 'configurations' in angular.json, or
- Run with an existing configuration name (check the target's configurations keys), or
- Omit the --configuration flag so default options are used.
Example fix
// before (angular.json target has no 'staging')
ng build --configuration staging
// after (angular.json)
"configurations": { "staging": { "fileReplacements": ["src/environments/environment.staging.ts"] } } Defensive patterns
Strategy: validation
Validate before calling
const cfg = workspace.projects.get(project)?.targets.get(target)?.configurations?.[configuration];
if (cfg === undefined) throw new Error(`Configuration '${configuration}' is not defined for target '${target}' of project '${project}'.`); Try / catch
try { options = await host.getOptionsForTarget({ project, target, configuration }); } catch (e) { if (String(e.message).includes('is not set in the workspace')) { /* fall back to default options or fix angular.json */ } else throw e; } Prevention
- List valid configurations with `ng config projects.<name>.architect.<target>.configurations` before running.
- Avoid hardcoding --configuration values in scripts; read them from angular.json.
- Standardize configuration names across CI scripts.
When it happens
Trigger: Calling architect getOptionsForTarget/getTargetOptions with a configuration name that is absent from the target's 'configurations' object in angular.json, e.g. running 'ng build my-app --configuration staging' when only 'production' and 'development' are defined.
Common situations: Typo in --configuration flag value; CI pipeline referencing a configuration renamed or removed during an upgrade; copying an ng command from another project that had extra configurations.
Related errors
- No project name provided and no default project found in wor
- Option "project" is required.
- Project is not defined in this workspace.
- PWA requires a project type of "application".
- Targets are not defined for this project.
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/149eadb1cab3fba6.
Report an issue: GitHub.