{"record":{"id":"a1837c97d93d2ccf","repo":"spring-projects/spring-boot","slug":"no-project-type-is-set-and-no-default-is-defined","errorCode":null,"errorMessage":"No project type is set and no default is defined. Check the service capabilities (--list)","messagePattern":"No project type is set and no default is defined\\. 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":396,"sourceCode":"\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() {\n\t\tif (this.artifactId != null) {\n\t\t\treturn this.artifactId;\n\t\t}\n\t\tif (this.output != null) {\n\t\t\tint i = this.output.lastIndexOf('.');\n\t\t\treturn (i != -1) ? this.output.substring(0, i) : this.output;\n\t\t}","sourceCodeStart":378,"sourceCodeEnd":414,"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#L378-L414","documentation":"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.","triggerScenarios":"A custom Initializr service whose metadata omits a default type, combined with a request that sets no --type and does not trigger detect mode.","commonSituations":"Pointing --target at a minimal or custom Initializr that has not configured a default type; a server downgrade that drops the default-type entry.","solutions":["Set --type explicitly to a supported id","Run 'spring init --list' to see available types","Configure the server to advertise a default type"],"exampleFix":"// before\n$ spring init --target https://custom-initializr.example.com\n// after\n$ spring init --target https://custom-initializr.example.com --type maven-project","handlingStrategy":"validation","validationCode":"// If the server may lack a default type, always supply one explicitly.\nInitializrServiceMetadata md = service.loadMetadata(serviceUrl);\nif (request.getType() == null && md.getDefaultType() == null) {\n    throw new IllegalStateException(\n        \"No default type advertised; set --type. Available: \" + md.getProjectTypes().keySet());\n}","typeGuard":null,"tryCatchPattern":"try {\n    request.determineProjectType(metadata);\n} catch (ReportableException ex) {\n    if (ex.getMessage().startsWith(\"No project type is set and no default\")) {\n        Log.error(\"Server has no default type - pass --type explicitly\");\n    }\n    throw ex;\n}","preventionTips":["Always pass --type for custom/unknown Initializr servers","Run --list to confirm a default type exists","Configure a default type on custom Initializr deployments"],"tags":["initializr","project-type","validation","configuration","spring-boot-cli"],"backgroundTag":null,"analyzedSha":"270dfe353fb830fd69b823a8a859287ff103854b","analyzedAt":"2026-08-11T19:42:06.541Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}