{"record":{"id":"d97de65e3a0400f0","repo":"ionic-team/ionic-framework","slug":"invalid-projecttype-for-projectname-config-p","errorCode":null,"errorMessage":"Invalid projectType for ${projectName}: ${config.projectType}","messagePattern":"Invalid projectType for (.+?): (.+?)","errorType":"exception","errorClass":"SchematicsException","httpStatus":null,"severity":"error","filePath":"packages/angular/src/schematics/utils/config.ts","lineNumber":60,"sourceCode":"    }\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);\n  angularJson.architect.build.options.styles.push({\n    input: stylePath,\n  });\n  writeConfig(host, config);\n}\n\nexport function addAsset(\n  host: Tree,\n  projectName: string,","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/ionic-team/ionic-framework/blob/625f9c38ad8c5db8a6c12df5c1622a36da90f9e3/packages/angular/src/schematics/utils/config.ts#L42-L78","documentation":"Thrown by getAngularJson() when the project exists but isAngularBrowserProject() returned false, AND the code could not confirm `config.projectType === 'application'`. Note the source reads `config.projectType` (the root-level field) rather than the per-project `projectConfig.projectType`, so in a standard Angular workspace this branch is hit whenever the targeted project is not recognized as a browser/application project — the message typically reports `undefined`.","triggerScenarios":"Targeting a project whose `projectType` is `library`, or an `application` project whose build target is not one of the three recognized browser/application builders. Because the check uses the root config's `projectType`, most non-browser projects land here.","commonSituations":"Running an Ionic schematic against an Angular library project; targeting an `app-e2e` or server-only project; workspace where the only application project uses a custom/unsupported builder so isAngularBrowserProject() returns false.","solutions":["Open angular.json and confirm the targeted project has `\"projectType\": \"application\"` and an `architect.build` target.","Re-run the schematic targeting the actual application project (see the keys in angular.json#projects).","If you must use a library/e2e project, that is unsupported — point the schematic at the browser application project instead.","If the project really is an application but uses a non-standard builder, see the related 'Invalid builder' error and switch to a supported builder."],"exampleFix":"// before (targeting a library)\nng add @ionic/angular --project shared-lib\n// after\ngrep '\"projectType\"' angular.json   // locate the \"application\" project\nng add @ionic/angular --project my-app","handlingStrategy":"validation","validationCode":"import { readFileSync } from 'fs';\nconst angularJson = JSON.parse(readFileSync('angular.json', 'utf8'));\nconst project = angularJson.projects?.[projectName];\nif (!project) throw new Error('project missing');\nif (project.projectType !== 'application') {\n  throw new Error(`${projectName} is ${project.projectType}, expected 'application'`);\n}","typeGuard":"function isApplicationProject(project: { projectType?: string }): boolean {\n  return project?.projectType === 'application';\n}","tryCatchPattern":null,"preventionTips":["Target only `application` projects with Ionic schematics.","Keep a single browser application project as the canonical target in multi-project workspaces.","Validate projectType in a pre-schematic hook or script."],"tags":["angular","schematics","configuration","project-type"],"backgroundTag":null,"analyzedSha":"625f9c38ad8c5db8a6c12df5c1622a36da90f9e3","analyzedAt":"2026-08-12T16:00:25.413Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}