{"record":{"id":"429e3c13c6dbf76c","repo":"angular/angular-cli","slug":"watch-mode-execution-serve-target-or-watch-option","errorCode":null,"errorMessage":"Watch mode execution (serve target or watch option) is not yet supported by 'run_target'. Please use the legacy 'devserver_start' / 'devserver_wait_for_build' tools instead.","messagePattern":"Watch mode execution \\(serve target or watch option\\) is not yet supported by 'run_target'\\. Please use the legacy 'devserver_start' / 'devserver_wait_for_build' tools instead\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/angular/cli/src/commands/mcp/tools/run-target/generic-target-strategy.ts","lineNumber":35,"sourceCode":"  'test',\n  'e2e',\n  'serve',\n  'deploy',\n  'extract-i18n',\n  'lint',\n]);\n\nexport class GenericTargetStrategy implements TargetStrategy {\n  canHandle(targetName: string, builder?: string): boolean {\n    return true; // Universal fallback strategy\n  }\n\n  async execute(\n    input: StrategyExecutionContext,\n    context: McpToolContext,\n  ): Promise<RunTargetOutput> {\n    if (input.targetName === 'serve' || input.options?.['watch'] === true) {\n      throw new Error(\n        `Watch mode execution (serve target or watch option) is not yet supported by 'run_target'. ` +\n          `Please use the legacy 'devserver_start' / 'devserver_wait_for_build' tools instead.`,\n      );\n    }\n\n    const args: string[] = [];\n    if (BUILT_IN_COMMANDS.has(input.targetName)) {\n      args.push(input.targetName, input.projectName);\n    } else {\n      args.push('run', `${input.projectName}:${input.targetName}`);\n    }\n\n    if (input.configuration) {\n      args.push(`--configuration=${input.configuration}`);\n    }\n\n    let options = input.options;\n    if (input.targetName === 'test') {","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular/cli/src/commands/mcp/tools/run-target/generic-target-strategy.ts#L17-L53","documentation":"The generic run_target strategy refuses to execute targets that require watch mode: the 'serve' target or any target invoked with watch: true. Watch mode is a long-running process the run_target tool does not support yet, so it throws and points users to the legacy devserver_start / devserver_wait_for_build MCP tools.","triggerScenarios":"Calling the run_target MCP tool with targetName === 'serve', or with options containing watch: true (e.g. { target: 'serve' } or { target: 'build', options: { watch: true } }) — the guard in execute() at generic-target-strategy.ts:35 throws.","commonSituations":"Migrating an agent workflow that previously used devserver_start to the new run_target tool; passing watch: true inherited from an angular.json serve configuration; assuming run_target supports hot-reload dev servers.","solutions":["Use the legacy devserver_start tool followed by devserver_wait_for_build for serve/watch scenarios","For run_target, drop options.watch (set it to false) and target a non-serve target such as build or test","Restrict the agent/tooling to call run_target only for one-shot builds and fall back to devserver tools for interactive serving"],"exampleFix":"// before\nrunTarget({ target: 'serve' });\n// after\ndevserverStart({});\nconst result = await devserverWaitForBuild({});","handlingStrategy":"fallback","validationCode":"if (input.targetName === 'serve' || input.options?.['watch'] === true) {\n  // route to legacy tools instead\n  devserverStart();\n}","typeGuard":"function isWatchable(input: { targetName: string; options?: Record<string, unknown> }): boolean {\n  return input.targetName === 'serve' || input.options?.['watch'] === true;\n}","tryCatchPattern":"try {\n  await runTarget(input);\n} catch (e) {\n  if ((e as Error).message.includes(\"not yet supported by 'run_target'\")) {\n    devserverStart();\n    await devserverWaitForBuild();\n  } else throw e;\n}","preventionTips":["Never call run_target with target 'serve' or watch: true","Branch on target type in agent code: one-shot builds via run_target, serving via devserver tools","Watch angular.json serve configuration defaults that imply watch mode"],"tags":["unsupported-feature","watch-mode","mcp","angular-cli"],"backgroundTag":"unsupported-operation","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}