{"record":{"id":"106f677e003eb8de","repo":"alibaba/spring-ai-alibaba","slug":"unknown-type-type-check-project-metadata","errorCode":null,"errorMessage":"Unknown type '${type}' check project metadata","messagePattern":"Unknown type '(.+?)' check project metadata","errorType":"validation","errorClass":"InvalidProjectRequestException","httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/builder/generator/service/generator/GraphProjectReqToDescConverter.java","lineNumber":139,"sourceCode":"\t\tvalidateLanguage(request.getLanguage(), metadata);\n\t\tvalidatePackaging(request.getPackaging(), metadata);\n\t\tvalidateDependencies(request, metadata);\n\t}\n\n\tprivate void validatePlatformVersion(ProjectRequest request, InitializrMetadata metadata) {\n\t\tVersion platformVersion = Version.safeParse(request.getBootVersion());\n\t\tInitializrConfiguration.Platform platform = metadata.getConfiguration().getEnv().getPlatform();\n\t\tif (platformVersion != null && !platform.isCompatibleVersion(platformVersion)) {\n\t\t\tthrow new InvalidProjectRequestException(\"Invalid Spring Boot version '\" + platformVersion\n\t\t\t\t\t+ \"', Spring Boot compatibility range is \" + platform.determineCompatibilityRangeRequirement());\n\t\t}\n\t}\n\n\tprivate void validateType(String type, InitializrMetadata metadata) {\n\t\tif (type != null) {\n\t\t\tType typeFromMetadata = metadata.getTypes().get(type);\n\t\t\tif (typeFromMetadata == null) {\n\t\t\t\tthrow new InvalidProjectRequestException(\"Unknown type '\" + type + \"' check project metadata\");\n\t\t\t}\n\t\t\tif (!typeFromMetadata.getTags().containsKey(\"build\")) {\n\t\t\t\tthrow new InvalidProjectRequestException(\n\t\t\t\t\t\t\"Invalid type '\" + type + \"' (missing build tag) check project metadata\");\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate void validateLanguage(String language, InitializrMetadata metadata) {\n\t\tif (language != null) {\n\t\t\tDefaultMetadataElement languageFromMetadata = metadata.getLanguages().get(language);\n\t\t\tif (languageFromMetadata == null) {\n\t\t\t\tthrow new InvalidProjectRequestException(\"Unknown language '\" + language + \"' check project metadata\");\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate void validatePackaging(String packaging, InitializrMetadata metadata) {","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/builder/generator/service/generator/GraphProjectReqToDescConverter.java#L121-L157","documentation":"validateType() looks up the requested project type (e.g. maven-build, gradle-build) in the Initializr metadata's registered types. If the id is not present, an InvalidProjectRequestException('Unknown type ... check project metadata') is thrown. Only type ids declared in the initializr metadata are accepted.","triggerScenarios":"Calling validate/convert with ProjectRequest type set to an id not present in metadata.getTypes() — e.g. type 'ant' or a typo like 'mave-build'.","commonSituations":"Typos in the type parameter, client sending a type from a different initializr instance, custom types not registered in the admin service's initializr metadata configuration.","solutions":["Use a registered type id such as 'maven-build' or 'gradle-build' (query the generator's metadata endpoint to list valid ids)","Register the custom type in the initializr metadata configuration (initializr.types in application.yml)","Fix the typo in the calling code or HTTP request parameter"],"exampleFix":"// before\nrequest.setType(\"mave-build\");\n// after\nrequest.setType(\"maven-build\");","handlingStrategy":"validation","validationCode":"if (type != null && !Set.of(\"maven-build\",\"gradle-build\").contains(type)) {\n    throw new IllegalArgumentException(\"type '\" + type + \"' not registered in metadata\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    converter.validate(request);\n} catch (InvalidProjectRequestException e) {\n    return ResponseEntity.badRequest().body(e.getMessage());\n}","preventionTips":["Query the metadata endpoint for valid type ids before submitting","Avoid free-text type values in clients; use a dropdown fed by metadata","Register custom types in initializr metadata"],"tags":["initializr","validation","project-generation"],"backgroundTag":"invalid-enum-value","analyzedSha":"f82da0b50f35744c13968191be2b1cd2452ef550","analyzedAt":"2026-09-09T15:32:42.421Z","contentChangedAt":"2026-09-09T15:32:42.421Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}