angular/angular-cli · warning
Skipping invalid target value; expected an object.
Error message
Skipping invalid target value; expected an object.
What it means
While parsing a project's targets (architect) section in angular.json, the reader skips any target whose value is not a JSON object and emits this warning, leaving that target undefined in the workspace.
Source
Thrown at packages/angular_devkit/core/src/workspace/json/reader.ts:283
jsonMetadata.addChange(['projects', projectName, ...path], value);
}
},
});
return Object.assign(project, base) as ProjectDefinition;
}
function parseTargetsObject(
projectName: string,
targetsNode: Node,
context: ParserContext,
): Record<string, TargetDefinition> {
const jsonMetadata = context.metadata;
const targets: Record<string, TargetDefinition> = Object.create(null);
for (const [name, value] of Object.entries<JsonValue>(getNodeValue(targetsNode))) {
if (!isJsonObject(value)) {
context.warn('Skipping invalid target value; expected an object.', value);
continue;
}
if (context.trackChanges) {
targets[name] = createVirtualAstObject<TargetDefinition>(value, {
include: ['builder', 'options', 'configurations', 'defaultConfiguration'],
listener(path, value) {
jsonMetadata.addChange(['projects', projectName, 'targets', name, ...path], value);
},
});
} else {
targets[name] = value as unknown as TargetDefinition;
}
}
return targets;
}
View on GitHub (pinned to bb72145f9a)
Solutions
- Restore the target to a full object: { "builder": "...", "options": {...} }.
- Delete the invalid target entry if it is not needed.
- Repair angular.json from version control or by re-running the schematic that created the target.
Example fix
// before (angular.json)
"architect": { "build": "@angular/build:application" }
// after
"architect": { "build": { "builder": "@angular/build:application", "options": {} } } Defensive patterns
Strategy: type-guard
Validate before calling
const json = require('./angular.json');
for (const [name, p] of Object.entries(json.projects ?? {})) {
const targets = p.architect ?? p.targets ?? {};
for (const [t, value] of Object.entries(targets)) {
if (typeof value !== 'object' || value === null || !('builder' in value)) {
throw new Error(`projects.${name} target '${t}' must be an object with a 'builder' property`);
}
}
} Type guard
function isValidTarget(v) {
return typeof v === 'object' && v !== null && typeof v.builder === 'string';
} Prevention
- Every target must be an object with at least a string 'builder' field; never abbreviate to the builder string.
- Fully resolve angular.json merge conflicts in architect/targets sections.
- Schema-validate angular.json in CI to catch malformed targets before builds.
When it happens
Trigger: parseTargetsObject iterates target entries and finds a value that is not an object (e.g. "build": "@angular/build:application" as a string instead of { "builder": ... }).
Common situations: Merge conflicts corrupting angular.json targets; hand-edits abbreviating a target to just its builder string; scripts writing placeholder target values.
Related errors
- Skipping invalid project value; expected an object.
- Project property "${name}" should be a string.
- Workspace extension with invalid name (${name}) found.
- Project '${projectName}' contains extension with invalid nam
- Invalid redirect status code: ${status}. Please use one of t
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/fe78356d0bb08068.
Report an issue: GitHub.