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
- Use 'list_projects' to locate the workspace directory that actually contains angular.json
- Point workspacePath at the directory that directly contains angular.json (workspace root)
- For Nx monorepos, verify the root layout — Nx can generate angular.json via nx migrate or use the correct root
- 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
- Verify angular.json exists at the exact directory given, not a parent or child
- In monorepos, resolve the app-specific workspace root before calling MCP tools
- Use 'list_projects' output as the source of truth for workspace paths
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
- Could not find ${level} workspace.
- Invalid config found at ${workspace.filePath}. CLI should be
- Cannot retrieve cache configuration as workspace is not defi
- Invalid Path.
- Confguration file cannot be found.
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/41624a97f912053a.
Report an issue: GitHub.