{"record":{"id":"3c561af181802972","repo":"spring-projects/spring-boot","slug":"invalid-service-url","errorCode":null,"errorMessage":"Invalid service URL ({})","messagePattern":"Invalid service URL \\((.+?)\\)","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":360,"sourceCode":"\t\t\t\tbuilder.setParameter(\"type\", projectType.getId());\n\t\t\t}\n\t\t\tif (this.packaging != null) {\n\t\t\t\tbuilder.setParameter(\"packaging\", this.packaging);\n\t\t\t}\n\t\t\tif (this.javaVersion != null) {\n\t\t\t\tbuilder.setParameter(\"javaVersion\", this.javaVersion);\n\t\t\t}\n\t\t\tif (this.language != null) {\n\t\t\t\tbuilder.setParameter(\"language\", this.language);\n\t\t\t}\n\t\t\tif (this.bootVersion != null) {\n\t\t\t\tbuilder.setParameter(\"bootVersion\", this.bootVersion);\n\t\t\t}\n\n\t\t\treturn builder.build();\n\t\t}\n\t\tcatch (URISyntaxException ex) {\n\t\t\tthrow new ReportableException(\"Invalid service URL (\" + ex.getMessage() + \")\");\n\t\t}\n\t}\n\n\tprotected ProjectType determineProjectType(InitializrServiceMetadata metadata) {\n\t\tif (this.type != null) {\n\t\t\tProjectType result = metadata.getProjectTypes().get(this.type);\n\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) {","sourceCodeStart":342,"sourceCodeEnd":378,"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#L342-L378","documentation":"Thrown by ProjectGenerationRequest.generateUrl() when constructing the full request URI raises a URISyntaxException. The base service URL plus query parameters (groupId, artifactId, version, javaVersion, bootVersion, language, etc.) must form a valid URI; any unencodable component fails.","triggerScenarios":"A project parameter contains characters that break the URI (raw spaces, control characters) that are not being encoded; or the --target base URL is itself malformed (missing scheme or host).","commonSituations":"Passing a groupId/artifactId with spaces or shell-special characters without quoting; a --target URL missing its scheme or host.","solutions":["Quote shell arguments containing special characters","Sanitize groupId/artifactId to Maven-friendly values (lowercase, no spaces)","Validate the --target URL has a scheme and host (e.g. https://host)"],"exampleFix":"// before\n$ spring init -a 'my artifact'\n// after\n$ spring init -a my-artifact","handlingStrategy":"validation","validationCode":"// Validate each component before the request builds its URI.\nString artifactId = request.getArtifactId();\nif (artifactId != null && !artifactId.matches(\"[a-zA-Z][a-zA-Z0-9_-]*\")) {\n    throw new IllegalArgumentException(\"artifactId must be URI-safe: \" + artifactId);\n}\nnew java.net.URI(request.getTarget()); // throws early on a malformed base URL","typeGuard":null,"tryCatchPattern":"try {\n    request.generateUrl();\n} catch (ReportableException ex) {\n    if (ex.getMessage().startsWith(\"Invalid service URL\")) {\n        Log.error(\"A parameter made the URL invalid - check artifactId/groupId/target\");\n    }\n    throw ex;\n}","preventionTips":["Keep groupId/artifactId to lowercase letters, digits, hyphens, dots","Quote shell arguments to prevent unwanted splitting/globbing","Always include a scheme on --target (https://)"],"tags":["uri","initializr","user-input","validation","spring-boot-cli"],"backgroundTag":null,"analyzedSha":"270dfe353fb830fd69b823a8a859287ff103854b","analyzedAt":"2026-08-11T19:42:06.541Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}