spring-projects/spring-boot · error · ReportableException
No project type is set and no default is defined. Check the…
Error message
No project type is set and no default is defined. Check the service capabilities (--list)
What it means
Thrown by ProjectGenerationRequest.determineProjectType when type detection is disabled (no --type, not detect mode) and the server metadata advertises no default type. With neither an explicit type nor a server default, no type can be chosen.
Solutions
- Set --type explicitly to a supported id
- Run 'spring init --list' to see available types
- Configure the server to advertise a default type
Example fix
// before $ spring init --target https://custom-initializr.example.com // after $ spring init --target https://custom-initializr.example.com --type maven-project
Defensive patterns
Strategy: validation
Validate before calling
// If the server may lack a default type, always supply one explicitly.
InitializrServiceMetadata md = service.loadMetadata(serviceUrl);
if (request.getType() == null && md.getDefaultType() == null) {
throw new IllegalStateException(
"No default type advertised; set --type. Available: " + md.getProjectTypes().keySet());
} Try / catch
try {
request.determineProjectType(metadata);
} catch (ReportableException ex) {
if (ex.getMessage().startsWith("No project type is set and no default")) {
Log.error("Server has no default type - pass --type explicitly");
}
throw ex;
} Prevention
- Always pass --type for custom/unknown Initializr servers
- Run --list to confirm a default type exists
- Configure a default type on custom Initializr deployments
When it happens
Trigger: A custom Initializr service whose metadata omits a default type, combined with a request that sets no --type and does not trigger detect mode.
Common situations: Pointing --target at a minimal or custom Initializr that has not configured a default type; a server downgrade that drops the default-type entry.
Related errors
- Could not save the project, the server did not set a…
- Multiple types found with build
- No project type with id
- No type found with build
- ' ' already exists. Use --force if you want to overwrite or…
AI-assisted analysis of spring-projects/spring-boot@270dfe353f (2026-08-11).
Data as JSON: /api/errors/a1837c97d93d2ccf.
Report an issue: GitHub.
Appendix: source
Thrown at cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java:396
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() {
if (this.artifactId != null) {
return this.artifactId;
}
if (this.output != null) {
int i = this.output.lastIndexOf('.');
return (i != -1) ? this.output.substring(0, i) : this.output;
}View on GitHub (pinned to 270dfe353f)