angular/angular-cli · error · Error

No angular.json found at ${workspacePathInput}. You can use

Error message

No angular.json found at ${workspacePathInput}. You can use 'list_projects' to find available workspaces.

What it means

After confirming the workspace path exists, resolveWorkspaceAndProject requires an angular.json file directly inside it. If join(workspacePathInput, 'angular.json') does not exist, it throws, again suggesting the 'list_projects' tool. The directory exists but is not an Angular CLI workspace root.

Source

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

  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.",
        );
      }
    }

    workspacePath = workspacePathInput;
    const configPath = join(workspacePath, 'angular.json');
    try {
      workspace = await AngularWorkspace.load(configPath);
    } catch (e) {

View on GitHub (pinned to bb72145f9a)

Solutions

  1. Use 'list_projects' to locate the workspace directory that actually contains angular.json
  2. Point workspacePath at the directory that directly contains angular.json (workspace root)
  3. For Nx monorepos, verify the root layout — Nx can generate angular.json via nx migrate or use the correct root
  4. If using an nx-style setup without angular.json, ensure the tool supports it or generate angular.json at the root

Example fix

// before
await resolveWorkspaceAndProject(host, { workspacePath: '/repo' }); // no angular.json here
// after
await resolveWorkspaceAndProject(host, { workspacePath: '/repo/apps/webapp' }); // contains angular.json
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync } from 'node:fs';
import { join } from 'node:path';
if (!existsSync(join(workspacePath, 'angular.json'))) {
  throw new Error(`Not an Angular workspace root (no angular.json): ${workspacePath}`);
}

Try / catch

try {
  await resolveWorkspaceAndProject(host, { workspacePath });
} catch (e) {
  if ((e as Error).message.includes('No angular.json found')) {
    console.error('Point workspacePath at the directory directly containing angular.json');
  } else throw e;
}

Prevention

When it happens

Trigger: Passing a workspacePath that is an existing directory but has no angular.json at its root — e.g. the repository root when angular.json lives in a subdirectory, or a package/ subfolder of a monorepo — triggering workspace-utils.ts:158.

Common situations: Pointing at a repo root in a monorepo where the Angular project is in apps/my-app; pointing at an Nx workspace root that uses workspace.json/project.json without an angular.json; pointing one level too high (e.g. ~/projects instead of ~/projects/my-app).

Related errors


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