{"record":{"id":"224d37fdbf188b8f","repo":"spring-projects/spring-boot","slug":"multiple-types-found-with-build-and-format","errorCode":null,"errorMessage":"Multiple types found with build '{}' and format '{}' use --type with a more specific value {}","messagePattern":"Multiple types found with build '(.+?)' and format '(.+?)' use --type with a more specific value (.+?)","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":389,"sourceCode":"\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)\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new ReportableException(\"Multiple types found with build '\" + this.build + \"' and format '\"\n\t\t\t\t\t\t+ this.format + \"' use --type with a more specific value \" + types.keySet());\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tProjectType defaultType = metadata.getDefaultType();\n\t\t\tif (defaultType == null) {\n\t\t\t\tthrow new ReportableException((\"No project type is set and no default is defined. \"\n\t\t\t\t\t\t+ \"Check the service capabilities (--list)\"));\n\t\t\t}\n\t\t\treturn defaultType;\n\t\t}\n\t}\n\n\t/**\n\t * Resolve the artifactId to use or {@code null} if it should not be customized.\n\t * @return the artifactId\n\t */\n\tprotected @Nullable String resolveArtifactId() {","sourceCodeStart":371,"sourceCodeEnd":407,"githubUrl":"https://github.com/spring-projects/spring-boot/blob/270dfe353fb830fd69b823a8a859287ff103854b/cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java#L371-L407","documentation":"Thrown by ProjectGenerationRequest.determineProjectType in detect-type mode when filtering by build and format leaves more than one candidate. The combination is ambiguous and the tool refuses to guess; the message lists the remaining candidate type ids.","triggerScenarios":"Type detection active with a build/format pair that maps to multiple server types, e.g. two gradle types differing by another attribute.","commonSituations":"Server exposes several types matching the same build+format; user wants determinism but did not pin --type.","solutions":["Pass --type with one of the ids listed in the error message","Run 'spring init --list' to inspect the candidate types","Narrow the selection with additional parameters the server supports"],"exampleFix":"// before\n$ spring init --build gradle\n// after\n$ spring init --build gradle --type gradle-project  # chosen from the listed candidates","handlingStrategy":"validation","validationCode":"// In detect mode, if filtering leaves >1 candidate, require an explicit type.\nInitializrServiceMetadata md = service.loadMetadata(serviceUrl);\njava.util.Map<String, ProjectType> candidates = new java.util.HashMap<>(md.getProjectTypes());\nif (request.getBuild() != null) filter(candidates, \"build\", request.getBuild());\nif (request.getFormat() != null) filter(candidates, \"format\", request.getFormat());\nif (candidates.size() > 1) {\n    throw new IllegalStateException(\n        \"Ambiguous type; choose one with --type: \" + candidates.keySet());\n}","typeGuard":null,"tryCatchPattern":"try {\n    request.determineProjectType(metadata);\n} catch (ReportableException ex) {\n    if (ex.getMessage().startsWith(\"Multiple types found\")) {\n        // the message lists candidate ids; surface them to the user\n        Log.error(ex.getMessage());\n    }\n    throw ex;\n}","preventionTips":["Set --type explicitly whenever more than one type could match","Inspect --list when build/format is ambiguous","Pin --type in automation for reproducible project generation"],"tags":["initializr","project-type","validation","ambiguous","spring-boot-cli"],"backgroundTag":null,"analyzedSha":"270dfe353fb830fd69b823a8a859287ff103854b","analyzedAt":"2026-08-11T19:42:06.541Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}