angular/angular-cli · error · SchematicsException
Project name "${options.project}" doesn't not exist.
Error message
Project name "${options.project}" doesn't not exist. What it means
The `config` schematic's Vitest branch (`addVitestConfig`) looks up the requested project in the workspace via `workspace.projects.get(options.project)` and throws this SchematicsException when no project with that exact name is registered in `angular.json` (or the workspace definition). It exists to fail fast instead of silently generating a config for a non-existent project. Note the message itself has a typo ("doesn't not exist") but the meaning is unambiguous: the project name could not be found.
Source
Thrown at packages/schematics/angular/config/index.ts:50
return addKarmaConfig(options);
case ConfigType.Browserslist:
return addBrowserslistConfig(project.root);
case ConfigType.Vitest:
return addVitestConfig(options);
default:
throw new SchematicsException(`"${options.type}" is an unknown configuration file type.`);
}
},
);
export default configSchematic;
function addVitestConfig(options: ConfigOptions): Rule {
return (tree, context) =>
updateWorkspace((workspace) => {
const project = workspace.projects.get(options.project);
if (!project) {
throw new SchematicsException(`Project name "${options.project}" doesn't not exist.`);
}
const testTarget = project.targets.get('test');
if (!testTarget) {
throw new SchematicsException(
`No "test" target found for project "${options.project}".` +
' A "test" target is required to generate a Vitest configuration.',
);
}
if (testTarget.builder !== AngularBuilder.BuildUnitTest) {
throw new SchematicsException(
`Cannot add a Vitest configuration as builder for "test" target in project does not` +
` use "${AngularBuilder.BuildUnitTest}".`,
);
}
testTarget.options ??= {};View on GitHub (pinned to bb72145f9a)
Solutions
- Run `ng generate config --help` / open angular.json and copy the exact project key under `"projects"` for the `--project` flag.
- List available projects with `ng generate config` in the workspace root or inspect angular.json to confirm the project exists and was not renamed or deleted.
- If the project was recently renamed, update scripts/CI to the new name, or restore the project entry in angular.json.
Example fix
// before ng g config my-appp --type vitest // after ng g config my-app --type vitest
Defensive patterns
Strategy: validation
Validate before calling
import { workspaces } from '@angular-devkit/core';
// or simply:
const angularJson = JSON.parse(tree.read('angular.json')!.toString('utf8'));
if (!angularJson.projects?.[options.project]) {
throw new Error(`Project "${options.project}" not in angular.json`);
} Type guard
function projectExists(name: string, projects: Record<string, unknown>): boolean {
return typeof name === 'string' && Object.prototype.hasOwnProperty.call(projects, name);
} Try / catch
try {
await schematicRunner.runSchematic('config', { project, type: 'vitest' });
} catch (e) {
if (e instanceof SchematicsException && e.message.includes('doesn\'t not exist')) {
console.error(`Unknown project "${project}". Check angular.json projects keys.`);
} else throw e;
} Prevention
- Always pass `--project` with the exact key from angular.json, not the package.json name.
- Run `ng generate` from the workspace root.
- Keep a workspace projects list in CI to validate project names before running schematics.
When it happens
Trigger: Running `ng generate config <project> --type vitest` (or invoking the config schematic programmatically) with a `--project` value that does not match any project key in angular.json — e.g. a typo, a dasherized vs camelCase mismatch, a deleted/renamed project, or omitting the project in a multi-project workspace where the default cannot be resolved to a real name.
Common situations: Monorepo users pointing at a library that was renamed; CI scripts with hard-coded project names after a reorganization; running the schematic before `ng add`/`ng generate application` created the project; copy-pasting a package.json name (npm scope name) instead of the angular.json project name.
Related errors
- Project name "${options.project}" doesn't not exist.
- Project "${projectName}" not found.
- Cannot find 'options' for ${projectName} ${target} target.
- outputPath for ${projectName} ${target} target is not a stri
- Invalid project name (${projectName})
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/f6cbe0563d09ca60.
Report an issue: GitHub.