{"record":{"id":"fe78356d0bb08068","repo":"angular/angular-cli","slug":"skipping-invalid-target-value-expected-an-object","errorCode":null,"errorMessage":"Skipping invalid target value; expected an object.","messagePattern":"Skipping invalid target value; expected an object\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/angular_devkit/core/src/workspace/json/reader.ts","lineNumber":283,"sourceCode":"          jsonMetadata.addChange(['projects', projectName, ...path], value);\n        }\n      },\n    });\n\n  return Object.assign(project, base) as ProjectDefinition;\n}\n\nfunction parseTargetsObject(\n  projectName: string,\n  targetsNode: Node,\n  context: ParserContext,\n): Record<string, TargetDefinition> {\n  const jsonMetadata = context.metadata;\n  const targets: Record<string, TargetDefinition> = Object.create(null);\n\n  for (const [name, value] of Object.entries<JsonValue>(getNodeValue(targetsNode))) {\n    if (!isJsonObject(value)) {\n      context.warn('Skipping invalid target value; expected an object.', value);\n      continue;\n    }\n\n    if (context.trackChanges) {\n      targets[name] = createVirtualAstObject<TargetDefinition>(value, {\n        include: ['builder', 'options', 'configurations', 'defaultConfiguration'],\n        listener(path, value) {\n          jsonMetadata.addChange(['projects', projectName, 'targets', name, ...path], value);\n        },\n      });\n    } else {\n      targets[name] = value as unknown as TargetDefinition;\n    }\n  }\n\n  return targets;\n}\n","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular_devkit/core/src/workspace/json/reader.ts#L265-L301","documentation":"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.","triggerScenarios":"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\": ... }).","commonSituations":"Merge conflicts corrupting angular.json targets; hand-edits abbreviating a target to just its builder string; scripts writing placeholder target values.","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."],"exampleFix":"// before (angular.json)\n\"architect\": { \"build\": \"@angular/build:application\" }\n// after\n\"architect\": { \"build\": { \"builder\": \"@angular/build:application\", \"options\": {} } }","handlingStrategy":"type-guard","validationCode":"const json = require('./angular.json');\nfor (const [name, p] of Object.entries(json.projects ?? {})) {\n  const targets = p.architect ?? p.targets ?? {};\n  for (const [t, value] of Object.entries(targets)) {\n    if (typeof value !== 'object' || value === null || !('builder' in value)) {\n      throw new Error(`projects.${name} target '${t}' must be an object with a 'builder' property`);\n    }\n  }\n}","typeGuard":"function isValidTarget(v) {\n  return typeof v === 'object' && v !== null && typeof v.builder === 'string';\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["angular","workspace-configuration","angular-json","validation"],"backgroundTag":"invalid-target-definition","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}