{"id":"472b8c9ff522afe0","repo":"spring-projects/spring-boot","slug":"no-type-found-with-build-this-build-and-format","errorCode":null,"errorMessage":"No type found with build '{this.build}' and format '{this.format}' check the service capabilities (--list)","messagePattern":"No type found with build '(.+?)' and format '(.+?)' 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":385,"sourceCode":"\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)\");\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/**","sourceCodeStart":367,"sourceCodeEnd":403,"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#L367-L403","documentation":"Thrown in detectType mode (no --type set) after filtering the service's project types by the requested --build and --format tags. If the filter leaves zero candidates, the combination is unsupported by the targeted Initializr service, so generation cannot proceed deterministically.","triggerScenarios":"Invoking `spring init --build <b> --format <f>` (or setting request.setBuild()/setFormat() with request.setDetectType(true)) where no advertised ProjectType has matching 'build' and 'format' tags. Also triggered implicitly when the CLI applies defaults that don't exist on a given service.","commonSituations":"Requesting a Gradle build on a service that only advertises Maven types; requesting a format the service dropped; pointing --target at a minimal/private Initializr that exposes only a subset of types; version mismatch between CLI expectations and service capabilities.","solutions":["Run `spring init --list` and verify the available build/format combinations.","Drop the unsupported --build or --format flag (or change it to an advertised value) so detection yields a match.","If the combination is genuinely required, point --target at an Initializr service version that supports it."],"exampleFix":"// before\n$ spring init --build gradle --format whatever myapp\n// after\n$ spring init --list   # confirm supported build/format pairs\n$ spring init --build gradle myapp   # omit invalid --format","handlingStrategy":"validation","validationCode":"InitializrServiceMetadata md = InitializrServiceMetadata.forService(request.getServiceUrl());\nboolean any = md.getProjectTypes().values().stream().anyMatch(t ->\n    (request.getBuild()  == null || request.getBuild().equals(t.getTags().get(\"build\"))) &&\n    (request.getFormat() == null || request.getFormat().equals(t.getTags().get(\"format\"))));\nif (!any) throw new IllegalArgumentException(\"No type matches build/format on this service\");","typeGuard":"// Validate the build/format tag pair exists before relying on detection\nboolean supported = metadata.getProjectTypes().values().stream()\n    .anyMatch(t -> Objects.equals(request.getBuild(), t.getTags().get(\"build\"))\n                && Objects.equals(request.getFormat(), t.getTags().get(\"format\")));","tryCatchPattern":"try { request.generateUrl(metadata); }\ncatch (ReportableException ex) {\n    if (ex.getMessage().startsWith(\"No type found with build\")) {\n        // surface available build/format combos to the user\n    } else throw ex;\n}","preventionTips":["Confirm build/format support via --list before scripting `spring init`.","Avoid mixing flags sourced from tutorials targeting a different service version.","Prefer an explicit --type when the build/format pair is critical and must not change."],"tags":["spring-boot-cli","initializr","project-generation","configuration"],"analyzedSha":"5b2dbdbb8be64415eb6552f81ff7c449c8d251e6","analyzedAt":"2026-08-04T18:53:14.967Z","schemaVersion":2}