{"record":{"id":"6513693039253f9c","repo":"angular/angular-cli","slug":"a-builder-is-not-set-for-target-target-in-pro","errorCode":null,"errorMessage":"A builder is not set for target '${target}' in project '${project}'.","messagePattern":"A builder is not set for target '(.+?)' in project '(.+?)'\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/angular_devkit/architect/node/node-modules-architect-host.ts","lineNumber":59,"sourceCode":"}\n\nfunction findProjectTarget(\n  workspace: workspaces.WorkspaceDefinition,\n  project: string,\n  target: string,\n): workspaces.TargetDefinition {\n  const projectDefinition = workspace.projects.get(project);\n  if (!projectDefinition) {\n    throw new Error(`Project \"${project}\" does not exist.`);\n  }\n\n  const targetDefinition = projectDefinition.targets.get(target);\n  if (!targetDefinition) {\n    throw new Error('Project target does not exist.');\n  }\n\n  if (!targetDefinition.builder) {\n    throw new Error(`A builder is not set for target '${target}' in project '${project}'.`);\n  }\n\n  return targetDefinition;\n}\n\nexport class WorkspaceNodeModulesArchitectHost implements ArchitectHost<NodeModulesBuilderInfo> {\n  private workspaceHost: WorkspaceHost;\n\n  constructor(workspaceHost: WorkspaceHost, _root: string);\n\n  constructor(workspace: workspaces.WorkspaceDefinition, _root: string);\n\n  constructor(\n    workspaceOrHost: workspaces.WorkspaceDefinition | WorkspaceHost,\n    protected _root: string,\n  ) {\n    if ('getBuilderName' in workspaceOrHost) {\n      this.workspaceHost = workspaceOrHost;","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular_devkit/architect/node/node-modules-architect-host.ts#L41-L77","documentation":"Once the target is found, `findProjectTarget` requires `targetDefinition.builder` to be set, since the architect host must resolve a builder implementation. This throws when a target exists in angular.json but has no `builder` property (or an empty one), which can only happen with hand-edited or programmatically built workspace definitions.","triggerScenarios":"angular.json contains a target object missing the `builder` key, e.g. `{ \"my-target\": { \"options\": {} } }` with no `\"builder\": \"@angular-devkit/build-angular:...\"` string; or code constructing TargetDefinition without a builder.","commonSituations":"Manual edits to angular.json; partial copy-paste of target blocks; migration tools stripping builder fields; custom schematic output that omits builder; renaming a builder package without updating the field.","solutions":["Add the `builder` property to the target in angular.json (e.g. `\"builder\": \"@angular-devkit/build-angular:application\"`).","Restore the target block from version control or regenerate it with `ng generate` / `ng add` of the relevant package.","Install the package providing the builder if the field references a missing dependency (also check spelling of the builder string).","In programmatic use, set `targets.set(name, { builder, ... })` before invoking the architect host."],"exampleFix":"// before\n\"my-target\": {\n  \"options\": {}\n}\n// after\n\"my-target\": {\n  \"builder\": \"@angular-devkit/build-angular:application\",\n  \"options\": {}\n}","handlingStrategy":"validation","validationCode":"const cfg = JSON.parse(fs.readFileSync('angular.json', 'utf8'));\nfor (const [name, t] of Object.entries<any>(cfg.projects?.[project]?.architect ?? {})) {\n  if (!t.builder) throw new Error(`Target \"${name}\" in project \"${project}\" is missing \"builder\".`);\n}","typeGuard":"function hasBuilder(t: unknown): t is { builder: string; options?: object } {\n  return typeof t === 'object' && t !== null && typeof (t as any).builder === 'string' && (t as any).builder.length > 0;\n}","tryCatchPattern":"try {\n  await architect.schedule(target, options, context);\n} catch (e) {\n  if ((e as Error).message.includes('A builder is not set for target')) {\n    console.error('Add a \"builder\" field to the angular.json target:', (e as Error).message);\n  } else { throw e; }\n}","preventionTips":["Never hand-edit angular.json without a schema-aware editor (IDE JSON schema validation catches this).","Copy-paste complete target blocks including the builder line.","Reinstall the builder package (`ng add`) after major upgrades to restore default target definitions."],"tags":["angular-cli","architect","workspace","configuration"],"backgroundTag":"missing-builder-definition","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}