{"record":{"id":"17a7265d8f5ef9d5","repo":"ionic-team/ionic-framework","slug":"could-not-find-project-projectname","errorCode":null,"errorMessage":"Could not find project: ${projectName}","messagePattern":"Could not find project: (.+?)","errorType":"exception","errorClass":"SchematicsException","httpStatus":null,"severity":"error","filePath":"packages/angular/src/schematics/utils/config.ts","lineNumber":51,"sourceCode":"\nexport function getDefaultAngularAppName(config: any): string {\n  const projects = config.projects;\n  const projectNames = Object.keys(projects);\n\n  for (const projectName of projectNames) {\n    const projectConfig = projects[projectName];\n    if (isAngularBrowserProject(projectConfig)) {\n      return projectName;\n    }\n  }\n\n  return projectNames[0];\n}\n\nfunction getAngularJson(config: any, projectName: string): any | never {\n  // eslint-disable-next-line no-prototype-builtins\n  if (!config.projects.hasOwnProperty(projectName)) {\n    throw new SchematicsException(`Could not find project: ${projectName}`);\n  }\n\n  const projectConfig = config.projects[projectName];\n  if (isAngularBrowserProject(projectConfig)) {\n    return projectConfig;\n  }\n\n  if (config.projectType !== 'application') {\n    throw new SchematicsException(`Invalid projectType for ${projectName}: ${config.projectType}`);\n  } else {\n    const buildConfig = projectConfig.architect.build;\n    throw new SchematicsException(`Invalid builder for ${projectName}: ${buildConfig.builder}`);\n  }\n}\n\nexport function addStyle(host: Tree, projectName: string, stylePath: string): void {\n  const config = readConfig(host);\n  const angularJson = getAngularJson(config, projectName);","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/ionic-team/ionic-framework/blob/625f9c38ad8c5db8a6c12df5c1622a36da90f9e3/packages/angular/src/schematics/utils/config.ts#L33-L69","documentation":"Thrown by the Ionic Angular schematic helper getAngularJson() when the requested project name is not a key in the workspace's angular.json \"projects\" map. The schematic cannot proceed because it needs a concrete project target to mutate (styles, assets, architect builders). It surfaces as an Angular SchematicsException during `ng add @ionic/angular` or any Ionic schematic that takes a `--project` flag.","triggerScenarios":"Calling `ng add @ionic/angular --project <name>` (or addStyle/addAsset/addArchitectBuilder internally) where `<name>` does not match any key in `angular.json#projects`. Also fires when `getDefaultAngularAppName` falls back to `projectNames[0]` and that first project is the one passed onward but the user later renamed/removed it.","commonSituations":"Typo in the `--project` flag; workspace has multiple projects (e.g. app + app-e2e) and the wrong/non-existent one was targeted; project was renamed in angular.json but the schematic was invoked with the old name; running the schematic from a sub-folder so a different angular.json is resolved.","solutions":["Run `ng config projects` (or open angular.json) and copy the exact key under \"projects\" to use as the `--project` value.","Re-run the schematic with the correct flag: `ng add @ionic/angular --project <exact-project-key>`.","If the workspace has no application project yet, generate one first (`ng generate application`) then re-run the schematic.","Ensure you run `ng add` from the directory that contains the angular.json you intend to modify."],"exampleFix":"// before\nng add @ionic/angular --project myApp\n// after (use the exact key from angular.json#projects)\nng config projects   // list keys, e.g. { \"my-app\": {...}, \"my-app-e2e\": {...} }\nng add @ionic/angular --project my-app","handlingStrategy":"validation","validationCode":"// Run before invoking the schematic (or before calling getAngularJson in a custom one)\nimport { readFileSync } from 'fs';\nconst angularJson = JSON.parse(readFileSync('angular.json', 'utf8'));\nconst projectExists = Object.prototype.hasOwnProperty.call(angularJson.projects ?? {}, projectName);\nif (!projectExists) {\n  throw new Error(`Project '${projectName}' not found. Available: ${Object.keys(angularJson.projects ?? {}).join(', ')}`);\n}","typeGuard":"function isKnownProject(config: { projects?: Record<string, unknown> }, name: string): boolean {\n  return !!config.projects && Object.prototype.hasOwnProperty.call(config.projects, name);\n}","tryCatchPattern":null,"preventionTips":["Always read the exact key from angular.json#projects before passing --project.","Avoid hard-coding project names; derive them from the workspace when possible.","Run schematics from the workspace root that owns angular.json."],"tags":["angular","schematics","configuration","workspace"],"backgroundTag":null,"analyzedSha":"625f9c38ad8c5db8a6c12df5c1622a36da90f9e3","analyzedAt":"2026-08-12T16:00:25.413Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}