angular/angular-cli · error · Error
Watch mode execution (serve target or watch option) is not y
Error message
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.
What it means
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.
Source
Thrown at packages/angular/cli/src/commands/mcp/tools/run-target/generic-target-strategy.ts:35
'test',
'e2e',
'serve',
'deploy',
'extract-i18n',
'lint',
]);
export class GenericTargetStrategy implements TargetStrategy {
canHandle(targetName: string, builder?: string): boolean {
return true; // Universal fallback strategy
}
async execute(
input: StrategyExecutionContext,
context: McpToolContext,
): Promise<RunTargetOutput> {
if (input.targetName === 'serve' || input.options?.['watch'] === true) {
throw new Error(
`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.`,
);
}
const args: string[] = [];
if (BUILT_IN_COMMANDS.has(input.targetName)) {
args.push(input.targetName, input.projectName);
} else {
args.push('run', `${input.projectName}:${input.targetName}`);
}
if (input.configuration) {
args.push(`--configuration=${input.configuration}`);
}
let options = input.options;
if (input.targetName === 'test') {View on GitHub (pinned to bb72145f9a)
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
Example fix
// before
runTarget({ target: 'serve' });
// after
devserverStart({});
const result = await devserverWaitForBuild({}); Defensive patterns
Strategy: fallback
Validate before calling
if (input.targetName === 'serve' || input.options?.['watch'] === true) {
// route to legacy tools instead
devserverStart();
} Type guard
function isWatchable(input: { targetName: string; options?: Record<string, unknown> }): boolean {
return input.targetName === 'serve' || input.options?.['watch'] === true;
} Try / catch
try {
await runTarget(input);
} catch (e) {
if ((e as Error).message.includes("not yet supported by 'run_target'")) {
devserverStart();
await devserverWaitForBuild();
} else throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Workspace path is outside the allowed MCP roots: ${workspace
- Workspace path is outside the allowed MCP roots: ${workspace
- The current directory resolves to a workspace outside the al
- Failed to update roots on notification: ${e instanceof Error
- Failed to initialize roots on connection: ${e instanceof Err
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/429e3c13c6dbf76c.
Report an issue: GitHub.