{"record":{"id":"1d1fb31c6e7dcd0c","repo":"cypress-io/cypress","slug":"invalid-project-name-options-project-1d1fb3","errorCode":null,"errorMessage":"Invalid project name: ${options.project}","messagePattern":"Invalid project name: (.+?)","errorType":"exception","errorClass":"SchematicsException","httpStatus":null,"severity":"error","filePath":"npm/cypress-schematic/src/schematics/ng-generate/cypress-test/index.ts","lineNumber":49,"sourceCode":"  }\n}\n\nexport default function (options: Schema): Rule {\n  return async (tree: Tree) => {\n    const host = createSpec(tree)\n    const { workspace } = await workspaces.readWorkspace('/', host)\n    const testType = options.component ? 'component' : 'e2e'\n\n    let project\n\n    if (!options.project) {\n      project = workspace.projects.get(workspace.extensions.defaultProject as string)\n    } else {\n      project = workspace.projects.get(options.project)\n    }\n\n    if (!project) {\n      throw new SchematicsException(`Invalid project name: ${options.project}`)\n    }\n\n    if (options.name === undefined) {\n      throw new SchematicsException(`No file name specified. This is required to generate a new Cypress file.`)\n    }\n\n    if (options.path === undefined) {\n      options.path = testType === 'component' ? `${project.sourceRoot}/${project.prefix}` : `${project.root}/cypress/e2e`\n    }\n\n    console.log(`Creating new ${testType} spec named: ${options.name}`)\n\n    const templatePath = testType === 'component' ? '../files/ct/__path__' : '../files/e2e/__path__'\n    const templateSource = createTemplate({ templatePath, options })\n\n    return chain([\n      mergeWith(templateSource),\n    ])","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/cypress-io/cypress/blob/0d85fdc91230885bca0a91df278312800a48b727/npm/cypress-schematic/src/schematics/ng-generate/cypress-test/index.ts#L31-L67","documentation":"Raised by the cypress-test ng-generate schematic after workspaces.readWorkspace resolves, when neither options.project nor the workspace's defaultProject yields a project from workspace.projects.get(). The schematic needs a real project to compute the spec output path (project.sourceRoot / project.root / project.prefix), so an unresolved project is fatal.","triggerScenarios":"Running `ng generate @cypress/schematic:cypress-test --project noSuch` where 'noSuch' is not a project in angular.json; OR running without --project when the workspace has no defaultProject (so the fallback lookup returns undefined).","commonSituations":"A typo in the --project name; a workspace with no defaultProject and no --project flag; a renamed project; an Angular CLI version that does not set options.project from the default.","solutions":["Pass the exact project name: `ng generate @cypress/schematic:cypress-test --project <name>` matching a key in angular.json projects.","If omitting --project, set a defaultProject at the top level of angular.json so the fallback resolves.","List valid projects with `ng config projects` or by inspecting angular.json, then use one of those names.","Check for typos and case sensitivity in the project name."],"exampleFix":"# before: ng g @cypress/schematic:cypress-test --project App\n# after: ng g @cypress/schematic:cypress-test --project app","handlingStrategy":"validation","validationCode":"function resolveProjectName(options: { project?: string }, defaultProject?: string, projects: Record<string, unknown>) {\n  const name = options.project ?? defaultProject\n  if (!name || !(name in projects)) {\n    throw new Error(`Invalid or missing project name: ${String(name ?? options.project)}`)\n  }\n  return name\n}","typeGuard":"function isKnownProject(name: string, projects: Record<string, unknown>): name is string {\n  return name in projects\n}","tryCatchPattern":null,"preventionTips":["Pass --project with a name that exists in angular.json projects.","Set a defaultProject in angular.json if you want to omit --project.","Check project name spelling and case before invoking the schematic."],"tags":["angular","schematic","ng-generate","project"],"backgroundTag":null,"analyzedSha":"0d85fdc91230885bca0a91df278312800a48b727","analyzedAt":"2026-08-12T16:24:28.056Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}