{"record":{"id":"3bd49963703b24ce","repo":"angular/angular-cli","slug":"project-options-project-does-not-exist-3bd499","errorCode":null,"errorMessage":"Project \"${options.project}\" does not exist.","messagePattern":"Project \"(.+?)\" does not exist\\.","errorType":"exception","errorClass":"SchematicsException","httpStatus":null,"severity":"error","filePath":"packages/schematics/angular/vitest-browser/index.ts","lineNumber":35,"sourceCode":"import {\n  DependencyType,\n  ExistingBehavior,\n  InstallBehavior,\n  addDependency,\n} from '../utility/dependency';\nimport { JSONFile } from '../utility/json-file';\nimport { latestVersions } from '../utility/latest-versions';\nimport { getWorkspace } from '../utility/workspace';\nimport { Builders } from '../utility/workspace-models';\nimport { Schema as VitestBrowserOptions } from './schema';\n\nexport default function (options: VitestBrowserOptions): Rule {\n  return async (host: Tree, _context: SchematicContext) => {\n    const workspace = await getWorkspace(host);\n    const project = workspace.projects.get(options.project);\n\n    if (!project) {\n      throw new SchematicsException(`Project \"${options.project}\" does not exist.`);\n    }\n\n    const testTarget = project.targets.get('test');\n    if (testTarget?.builder !== Builders.BuildUnitTest) {\n      throw new SchematicsException(\n        `Project \"${options.project}\" does not have a \"test\" target with a supported builder.`,\n      );\n    }\n\n    if (testTarget.options?.['runner'] === 'karma') {\n      throw new SchematicsException(\n        `Project \"${options.project}\" is configured to use Karma. ` +\n          'Please migrate to Vitest before adding browser testing support.',\n      );\n    }\n\n    const packageName = options.package;\n    if (!packageName) {","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/schematics/angular/vitest-browser/index.ts#L17-L53","documentation":"The vitest-browser schematic adds browser-testing support to a project's Vitest setup. It first resolves options.project from the workspace; if no project with that name exists it throws this SchematicsException before touching any config.","triggerScenarios":"Running `ng generate vitest-browser` (or the equivalent schematic invocation) with --project set to a name absent from the \"projects\" map in angular.json.","commonSituations":"Typos in the project name, running in a monorepo with multiple libs/apps and referencing an old or deleted project, or executing the schematic outside a proper Angular workspace.","solutions":["Pass an existing project: `ng g vitest-browser --project=my-app` where my-app appears in angular.json.","List available projects via angular.json or `ng config projects` and correct the name.","Run the command from the workspace root so the correct angular.json is loaded."],"exampleFix":"// before\nng g vitest-browser --project=frontned\n// after\nng g vitest-browser --project=frontend","handlingStrategy":"validation","validationCode":"const ws = JSON.parse(fs.readFileSync('angular.json', 'utf8'));\nif (!ws.projects?.[options.project]) {\n  throw new Error(`Project \"${options.project}\" missing; available: ${Object.keys(ws.projects ?? {}).join(', ')}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await ngGenerate(['vitest-browser', '--project', name]);\n} catch (e) {\n  if (String((e as Error).message).includes('does not exist')) {\n    console.error(`Fix --project: no such project \"${name}\" in angular.json.`);\n  } else throw e;\n}","preventionTips":["Cross-check --project against the \"projects\" keys in angular.json before running the schematic.","Run schematics from the workspace root.","Keep project names in a shared list/CI check so deleted or renamed projects are not referenced."],"tags":["schematics","vitest","workspace"],"backgroundTag":"project-not-found-in-workspace","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}