angular/angular-cli · error · Error

Workspace path does not exist: ${workspacePathInput}. You ca

Error message

Workspace path does not exist: ${workspacePathInput}. You can use 'list_projects' to find available workspaces.

What it means

resolveWorkspaceAndProject resolves the Angular workspace for MCP tools. When a workspacePathInput is supplied, it first checks host.existsSync(workspacePathInput); if the path is absent it throws with a hint to use the 'list_projects' MCP tool to discover valid workspace paths.

Source

Thrown at packages/angular/cli/src/commands/mcp/workspace-utils.ts:152

  projectNameInput,
  mcpWorkspace,
}: {
  host: Host;
  server?: McpToolContext['server'];
  workspacePathInput?: string;
  projectNameInput?: string;
  mcpWorkspace?: AngularWorkspace;
}): Promise<{
  workspace: AngularWorkspace;
  workspacePath: string;
  projectName: string;
}> {
  let workspacePath: string;
  let workspace: AngularWorkspace;

  if (workspacePathInput) {
    if (!host.existsSync(workspacePathInput)) {
      throw new Error(
        `Workspace path does not exist: ${workspacePathInput}. ` +
          "You can use 'list_projects' to find available workspaces.",
      );
    }
    if (!host.existsSync(join(workspacePathInput, 'angular.json'))) {
      throw new Error(
        `No angular.json found at ${workspacePathInput}. ` +
          "You can use 'list_projects' to find available workspaces.",
      );
    }
    if (server) {
      if (!(await isAllowedWorkspacePath(server, workspacePathInput))) {
        throw new Error(
          `Workspace path is outside the allowed MCP roots: ${workspacePathInput}. ` +
            "You can use 'list_projects' to find available workspaces.",
        );
      }
    }

View on GitHub (pinned to bb72145f9a)

Solutions

  1. Call the 'list_projects' MCP tool to get valid workspace paths and use one of those
  2. Verify the path exists on the machine where the MCP server runs (not the client)
  3. Pass an absolute path to the directory containing angular.json
  4. Omit workspacePath entirely if only one workspace exists so it can be auto-discovered

Example fix

// before
await resolveWorkspaceAndProject(host, { workspacePath: './my-app' });
// after
const p = '/home/user/projects/my-app'; // absolute, verified to exist
if (!host.existsSync(p)) throw new Error(`No such dir: ${p}`);
await resolveWorkspaceAndProject(host, { workspacePath: p });
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync } from 'node:fs';
if (!existsSync(workspacePath)) {
  throw new Error(`Workspace path does not exist: ${workspacePath}`);
}

Try / catch

try {
  await resolveWorkspaceAndProject(host, { workspacePath });
} catch (e) {
  if ((e as Error).message.includes('Workspace path does not exist')) {
    const projects = await listProjects(); // discover valid workspace paths
    console.error(`Use one of: ${projects.map((p) => p.path).join(', ')}`);
  } else throw e;
}

Prevention

When it happens

Trigger: Calling any MCP tool that accepts a workspacePath with a path that does not exist on the host filesystem (existsSync fails) — e.g. { workspacePath: '/wrong/dir', projectName: 'app' } hitting workspace-utils.ts:152.

Common situations: Typos in the workspace path; passing a path relative to a different cwd than the MCP server's; workspace directory renamed or deleted; hardcoding a path from a different machine in agent configuration.

Related errors


AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30). Data as JSON: /api/errors/a677a286d67d9fb3. Report an issue: GitHub.