{"record":{"id":"7e8e749fd02a56ba","repo":"cypress-io/cypress","slug":"invalid-project-name-options-project","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-ct-tests/index.ts","lineNumber":9,"sourceCode":"import { Rule, Tree, SchematicsException } from '@angular-devkit/schematics'\n\nimport { getAngularJsonValue, getDirectoriesAndCreateSpecs } from '../../utils'\nimport { Schema } from './schema'\n\nexport default function (options: Schema): Rule {\n  return (tree: Tree) => {\n    if (!options.project) {\n      throw new SchematicsException(`Invalid project name: ${options.project}`)\n    }\n\n    const angularJsonValue = getAngularJsonValue(tree)\n    const { projects } = angularJsonValue\n    const project = projects[options.project]\n\n    const appPath = `${project.sourceRoot}`\n\n    return getDirectoriesAndCreateSpecs({ tree, appPath })\n  }\n}\n","sourceCodeStart":1,"sourceCodeEnd":21,"githubUrl":"https://github.com/cypress-io/cypress/blob/0d85fdc91230885bca0a91df278312800a48b727/npm/cypress-schematic/src/schematics/ng-generate/cypress-ct-tests/index.ts#L1-L21","documentation":"Raised by the cypress-ct-tests ng-generate schematic when options.project is falsy. This schematic generates component-testing specs by reading the named project from angular.json (projects[options.project]) and needs a concrete project to locate sourceRoot, so it refuses to run without one rather than guessing.","triggerScenarios":"Running `ng generate @cypress/schematic:cypress-ct-tests` (or the alias) without a --project flag in a workspace that has no default project resolution into options.project, or with an explicit empty --project.","commonSituations":"Forgetting the --project flag in a multi-app workspace; a wrapper script that drops the flag; an Angular CLI version that does not auto-populate options.project from the default project.","solutions":["Pass the project name explicitly: `ng generate @cypress/schematic:cypress-ct-tests --project <name>`.","Confirm the project name matches a key under projects in angular.json.","If you expect a default project, ensure angular.json sets a defaultProject (note: this schematic does not fall back to it — you must pass --project)."],"exampleFix":"# before: ng g @cypress/schematic:cypress-ct-tests\n# after: ng g @cypress/schematic:cypress-ct-tests --project app","handlingStrategy":"validation","validationCode":"function assertProjectOption(options: { project?: string }) {\n  if (!options.project) {\n    throw new Error('--project is required for the cypress-ct-tests schematic')\n  }\n  return options.project\n}","typeGuard":"function hasProjectName(o: { project?: string }): o is { project: string } {\n  return typeof o.project === 'string' && o.project.length > 0\n}","tryCatchPattern":null,"preventionTips":["Always pass --project when invoking this schematic in a multi-app workspace.","Validate the project name against angular.json projects before running.","Wrap the schematic in a script that asserts --project is set."],"tags":["angular","schematic","ng-generate","ct","project"],"backgroundTag":null,"analyzedSha":"0d85fdc91230885bca0a91df278312800a48b727","analyzedAt":"2026-08-12T16:24:28.056Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}