angular/angular-cli · error · Error
No project name provided and no default project found in wor
Error message
No project name provided and no default project found in workspace path ${workspacePath}. Please provide a project name or set a default project in angular.json. You can use 'list_projects' to find available projects. What it means
Thrown by resolveWorkspaceAndProject when no projectName was provided AND getDefaultProjectName(workspace) returned nothing, so no project can be inferred. The Angular CLI refuses to guess; the user must pass a project name or configure a default project in angular.json.
Source
Thrown at packages/angular/cli/src/commands/mcp/workspace-utils.ts:221
} catch (e) {
throw new Error(`Failed to load workspace configuration at ${configPath}.`, { cause: e });
}
}
let projectName = projectNameInput;
if (projectName) {
if (!workspace.projects.has(projectName)) {
throw new Error(
`Project '${projectName}' not found in workspace path ${workspacePath}. ` +
"You can use 'list_projects' to find available projects.",
);
}
} else {
projectName = getDefaultProjectName(workspace);
}
if (!projectName) {
throw new Error(
`No project name provided and no default project found in workspace path ${workspacePath}. ` +
'Please provide a project name or set a default project in angular.json. ' +
"You can use 'list_projects' to find available projects.",
);
}
return { workspace, workspacePath, projectName };
}
View on GitHub (pinned to bb72145f9a)
Solutions
- Pass an explicit projectName argument to the tool.
- Add "defaultProject": "<name>" to angular.json, or set "default": true on a project.
- Run list_projects to see which projects are available, then choose one.
Example fix
// before
{ "workspacePath": "/repo" }
// after
{ "workspacePath": "/repo", "projectName": "admin-app" }
// or in angular.json: "defaultProject": "admin-app" Defensive patterns
Strategy: validation
Validate before calling
const pkg = require('./angular.json');
if (!projectName && !pkg.defaultProject) {
throw new Error('projectName required: workspace has no defaultProject');
} Type guard
function hasProjectArg(args: { projectName?: string }): args is { projectName: string } {
return typeof args.projectName === 'string' && args.projectName.length > 0;
} Prevention
- Set "defaultProject" in angular.json for single-app workspaces.
- Never omit projectName in multi-project repos.
- Add a CI check that angular.json declares a default or scripts always pass a project.
When it happens
Trigger: Calling an MCP tool with { workspacePath } (no projectName) on a workspace that has no default project: either 'defaultProject' is absent from angular.json (removed in modern Angular workspaces), no CLI builder project exists, or multiple projects with none marked default.
Common situations: New Angular 15+ workspaces where 'defaultProject' was dropped; multi-project monorepos; minimal libraries-only workspaces; automated scripts that omit projectName assuming a default exists.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Project '${projectName}' not found in workspace path ${works
- Option "project" is required.
- Unknown argument: configuration. Provide the configuration a
- Cannot determine project or target.
- Repository is not clean. Please commit or stash any changes
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/0bf4f604101bc639.
Report an issue: GitHub.