{"record":{"id":"114e48fc41954af1","repo":"quarkusio/quarkus","slug":"empty-host","errorCode":null,"errorMessage":"empty host","messagePattern":"empty host","errorType":"exception","errorClass":"UriBuilderException","httpStatus":null,"severity":"error","filePath":"independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/jaxrs/UriBuilderImpl.java","lineNumber":551,"sourceCode":"            boolean encodeSlash) {\n        return buildCharSequence(paramMap, fromEncodedMap, isTemplate, encodeSlash).toString();\n    }\n\n    private CharSequence buildCharSequence(Map<String, ? extends Object> paramMap, boolean fromEncodedMap, boolean isTemplate,\n            boolean encodeSlash) {\n        StringBuilder builder = new StringBuilder();\n\n        if (scheme != null)\n            replaceParameter(paramMap, fromEncodedMap, isTemplate, scheme, builder, encodeSlash).append(\":\");\n        if (ssp != null) {\n            builder.append(ssp);\n        } else if (userInfo != null || host != null || port != -1) {\n            builder.append(\"//\");\n            if (userInfo != null)\n                replaceParameter(paramMap, fromEncodedMap, isTemplate, userInfo, builder, encodeSlash).append(\"@\");\n            if (host != null) {\n                if (\"\".equals(host))\n                    throw new UriBuilderException(\"empty host\");\n                replaceParameter(paramMap, fromEncodedMap, isTemplate, host, builder, encodeSlash);\n            }\n            if (port != -1)\n                builder.append(\":\").append(Integer.toString(port));\n        } else if (authority != null) {\n            builder.append(\"//\");\n            replaceParameter(paramMap, fromEncodedMap, isTemplate, authority, builder, encodeSlash);\n        }\n        if (path != null) {\n            StringBuilder tmp = new StringBuilder();\n            replaceParameter(paramMap, fromEncodedMap, isTemplate, path, tmp, encode, encodeSlash);\n            if (userInfo != null || host != null) {\n                if (tmp.length() > 0 && tmp.charAt(0) != '/')\n                    builder.append(\"/\");\n            }\n            builder.append(tmp);\n        }\n        if (query != null) {","sourceCodeStart":533,"sourceCodeEnd":569,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/jaxrs/UriBuilderImpl.java#L533-L569","documentation":"Thrown from buildCharSequence when the builder has an authority component (userInfo, host, or port set) but host is the empty string \"\". A URI with an authority must have a non-empty host, so building would yield an invalid '//:port' or '//user@' form. It is a UriBuilderException, i.e. the builder state itself is wrong, independent of the template parameters.","triggerScenarios":"Calling UriBuilderImpl.host(\"\") (or host(null) then mutating to empty), or parsing/config loading that sets an empty host, then invoking build()/buildFromMap()/resolveTemplate*.","commonSituations":"Config property like quarkus.rest-client.url=https://:8080 or an env var HOST=\"\" defaulting to empty; URL parsing code that splits on ':' and yields empty host; programmatic client setup where the host string came from an unset variable.","solutions":["Check what value was passed to UriBuilder.host()/the builder's host field; ensure it is non-empty before build()","Fix the source of the empty host: config property, env var, or URL-parsing code","If host is optional, do not call host() at all instead of passing \"\" — build the authority only when host is present","Add a guard that rejects blank host strings before configuring the builder"],"exampleFix":"// before\nString host = config.hostname(); // may be \"\"\nURI uri = UriBuilder.fromScheme(\"https\").host(host).port(8080).build();\n// after\nString host = config.hostname();\nUriBuilder b = UriBuilder.fromUri(\"https://api.example.com\");\nif (host != null && !host.isBlank()) { b.host(host); }\nURI uri = b.build();","handlingStrategy":"validation","validationCode":"if (host == null || host.isBlank()) {\n    throw new IllegalStateException(\"Host must be non-empty before building URI\");\n}\nbuilder.host(host);","typeGuard":"static boolean hasHost(String host) { return host != null && !host.isBlank(); }","tryCatchPattern":"try {\n    URI uri = builder.build();\n} catch (UriBuilderException e) {\n    throw new IllegalStateException(\"Builder misconfigured (empty host/scheme?). Check base URL config.\", e);\n}","preventionTips":["Validate base-URL config at startup (fail fast if host part is blank)","Never call host(\"\"); omit the host() call when there is no host","Parse base URLs with new URI(...) at config-load time to catch empty authorities early"],"tags":["uri","resteasy-reactive","configuration"],"backgroundTag":"invalid-uri-syntax","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}