{"id":"8990c4e8c8cb0445","repo":"spring-projects/spring-boot","slug":"no-project-type-with-id-this-type-check-the","errorCode":null,"errorMessage":"No project type with id '${this.type}' - check the service capabilities (--list)","messagePattern":"No project type with id '(.+?)' - check the service capabilities \\(--list\\)","errorType":"exception","errorClass":"ReportableException","httpStatus":null,"severity":"error","filePath":"cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java","lineNumber":368,"sourceCode":"\t\t\tif (this.language != null) {\n\t\t\t\tbuilder.setParameter(\"language\", this.language);\n\t\t\t}\n\t\t\tif (this.bootVersion != null) {\n\t\t\t\tbuilder.setParameter(\"bootVersion\", this.bootVersion);\n\t\t\t}\n\n\t\t\treturn builder.build();\n\t\t}\n\t\tcatch (URISyntaxException ex) {\n\t\t\tthrow new ReportableException(\"Invalid service URL (\" + ex.getMessage() + \")\");\n\t\t}\n\t}\n\n\tprotected ProjectType determineProjectType(InitializrServiceMetadata metadata) {\n\t\tif (this.type != null) {\n\t\t\tProjectType result = metadata.getProjectTypes().get(this.type);\n\t\t\tif (result == null) {\n\t\t\t\tthrow new ReportableException(\n\t\t\t\t\t\t(\"No project type with id '\" + this.type + \"' - check the service capabilities (--list)\"));\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t\telse if (isDetectType()) {\n\t\t\tMap<String, ProjectType> types = new HashMap<>(metadata.getProjectTypes());\n\t\t\tif (this.build != null) {\n\t\t\t\tfilter(types, \"build\", this.build);\n\t\t\t}\n\t\t\tif (this.format != null) {\n\t\t\t\tfilter(types, \"format\", this.format);\n\t\t\t}\n\t\t\tif (types.size() == 1) {\n\t\t\t\treturn types.values().iterator().next();\n\t\t\t}\n\t\t\telse if (types.isEmpty()) {\n\t\t\t\tthrow new ReportableException(\"No type found with build '\" + this.build + \"' and format '\" + this.format\n\t\t\t\t\t\t+ \"' check the service capabilities (--list)\");","sourceCodeStart":350,"sourceCodeEnd":386,"githubUrl":"https://github.com/spring-projects/spring-boot/blob/5b2dbdbb8be64415eb6552f81ff7c449c8d251e6/cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java#L350-L386","documentation":"Thrown by ProjectGenerationRequest.determineProjectType when the caller has explicitly set a project type id (via --type) but that id does not exist among the project types advertised by the Initializr service (start.spring.io or a custom --target). The library refuses to guess because the type id drives the generation endpoint path (projectType.getAction()) and a wrong id would produce a meaningless request.","triggerScenarios":"Calling `spring init --type <id>` (or programmatically request.setType(id)) where <id> is not a key in InitializrServiceMetadata.getProjectTypes(). Common when the id is misspelled, uses the wrong case, or was renamed/removed in a newer service version.","commonSituations":"Switching the target Initializr instance (e.g. an older internal start server) that advertises a different set of type ids; upgrading Spring Boot CLI against a service that renamed a type (e.g. 'maven-project' vs 'maven-build'); copy-pasting a --type value from an outdated tutorial.","solutions":["Run `spring init --list` (or query the service metadata) and copy the exact 'id' of the desired type from the printed capabilities.","Remove the --type flag to let the CLI auto-detect the type from --build and --format, or fall back to the service default.","If using a custom service, point --target at one whose capabilities actually include the type you need, and confirm the service version."],"exampleFix":"// before\n$ spring init --type mavenproject myapp\n// after\n$ spring init --list   # copy exact id, e.g. 'maven-project'\n$ spring init --type maven-project myapp","handlingStrategy":"validation","validationCode":"InitializrServiceMetadata md = InitializrServiceMetadata.forService(request.getServiceUrl());\nif (request.getType() != null && !md.getProjectTypes().containsKey(request.getType())) {\n    throw new IllegalArgumentException(\n        \"Unknown type '\" + request.getType() + \"'. Available: \" + md.getProjectTypes().keySet());\n}","typeGuard":"// Java: prefer the typed ProjectType lookup rather than a raw id string\nProjectType t = (request.getType() != null)\n    ? metadata.getProjectTypes().get(request.getType())\n    : null;\nif (request.getType() != null && t == null) {\n    // reject before generateUrl()\n}","tryCatchPattern":"try {\n    URI u = request.generateUrl(metadata);\n} catch (ReportableException ex) {\n    if (ex.getMessage().contains(\"No project type with id\")) {\n        // prompt user to run --list and supply a valid --type\n    } else throw ex;\n}","preventionTips":["Always source --type ids from `spring init --list` output for the exact --target you will use.","When scripting, fetch service metadata first and validate the type id against getProjectTypes().keySet().","Pin the service version to avoid type-id drift across upgrades."],"tags":["spring-boot-cli","initializr","project-generation","configuration"],"analyzedSha":"5b2dbdbb8be64415eb6552f81ff7c449c8d251e6","analyzedAt":"2026-08-04T18:53:14.967Z","schemaVersion":2}