spring-projects/spring-boot · error · ReportableException
Multiple types found with build '{}' and format '{}' use --t
Error message
Multiple types found with build '{}' and format '{}' use --type with a more specific value {} What it means
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.
Source
Thrown at cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java:389
return result;
}
else if (isDetectType()) {
Map<String, ProjectType> types = new HashMap<>(metadata.getProjectTypes());
if (this.build != null) {
filter(types, "build", this.build);
}
if (this.format != null) {
filter(types, "format", this.format);
}
if (types.size() == 1) {
return types.values().iterator().next();
}
else if (types.isEmpty()) {
throw new ReportableException("No type found with build '" + this.build + "' and format '" + this.format
+ "' check the service capabilities (--list)");
}
else {
throw new ReportableException("Multiple types found with build '" + this.build + "' and format '"
+ this.format + "' use --type with a more specific value " + types.keySet());
}
}
else {
ProjectType defaultType = metadata.getDefaultType();
if (defaultType == null) {
throw new ReportableException(("No project type is set and no default is defined. "
+ "Check the service capabilities (--list)"));
}
return defaultType;
}
}
/**
* Resolve the artifactId to use or {@code null} if it should not be customized.
* @return the artifactId
*/
protected @Nullable String resolveArtifactId() {View on GitHub (pinned to 270dfe353f)
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
Example fix
// before $ spring init --build gradle // after $ spring init --build gradle --type gradle-project # chosen from the listed candidates
Defensive patterns
Strategy: validation
Validate before calling
// In detect mode, if filtering leaves >1 candidate, require an explicit type.
InitializrServiceMetadata md = service.loadMetadata(serviceUrl);
java.util.Map<String, ProjectType> candidates = new java.util.HashMap<>(md.getProjectTypes());
if (request.getBuild() != null) filter(candidates, "build", request.getBuild());
if (request.getFormat() != null) filter(candidates, "format", request.getFormat());
if (candidates.size() > 1) {
throw new IllegalStateException(
"Ambiguous type; choose one with --type: " + candidates.keySet());
} Try / catch
try {
request.determineProjectType(metadata);
} catch (ReportableException ex) {
if (ex.getMessage().startsWith("Multiple types found")) {
// the message lists candidate ids; surface them to the user
Log.error(ex.getMessage());
}
throw ex;
} Prevention
- 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
When it happens
Trigger: Type detection active with a build/format pair that maps to multiple server types, e.g. two gradle types differing by another attribute.
Common situations: Server exposes several types matching the same build+format; user wants determinism but did not pin --type.
Related errors
- No project type with id '{}' - check the service capabilitie
- No type found with build '{}' and format '{}' check the serv
- No project type is set and no default is defined. Check the
- Invalid service URL ({})
- Could not save the project, the server did not set a preferr
AI-assisted analysis of spring-projects/spring-boot@270dfe353f (2026-08-11).
Data as JSON: /api/errors/224d37fdbf188b8f.
Report an issue: GitHub.