{"record":{"id":"74fbd992eca9de8e","repo":"quarkusio/quarkus","slug":"invalid-host","errorCode":null,"errorMessage":"invalid host","messagePattern":"invalid host","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/jaxrs/UriBuilderImpl.java","lineNumber":343,"sourceCode":"            userInfo = uri.getRawUserInfo();\n            host = uri.getHost();\n            port = uri.getPort();\n            path = uri.getRawPath();\n            query = uri.getRawQuery();\n\n        }\n        return this;\n\n    }\n\n    public UriBuilder userInfo(String ui) {\n        this.userInfo = ui;\n        return this;\n    }\n\n    public UriBuilder host(String host) throws IllegalArgumentException {\n        if (host != null && host.equals(\"\"))\n            throw new IllegalArgumentException(\"invalid host\");\n        this.host = host;\n        return this;\n    }\n\n    public UriBuilder port(int port) throws IllegalArgumentException {\n        if (port < -1)\n            throw new IllegalArgumentException(\"invalid port\");\n        this.port = port;\n        return this;\n    }\n\n    public UriBuilder encode(boolean encode) {\n        this.encode = encode;\n        return this;\n    }\n\n    protected static String paths(boolean encode, String basePath, String... segments) {\n        String path = basePath;","sourceCodeStart":325,"sourceCodeEnd":361,"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#L325-L361","documentation":"UriBuilderImpl.host(String) throws 'invalid host' when the host argument is non-null but the empty string. An empty host would produce an invalid authority (http:///path), so the builder rejects it per the JAX-RS contract. Passing null is allowed and clears the host.","triggerScenarios":"Calling builder.host(\"\") directly; a host extracted via regex/split that produced an empty group; a configured URL like 'http://:8080/' where the host group is empty; env substitution leaving the host variable empty.","commonSituations":"Parsing 'http://:8080/' where the host token is empty; HOST env var unset or blank; String.split/subset on a missing delimiter yielding an empty token; blank default values in configuration.","solutions":["Pass a real hostname, or null to unset the host - never the empty string","Validate/trim the configured host and skip the call when blank","Take the host from URI.getHost() instead of manual splitting","Guard with a blank check at your call site for a clearer failure"],"exampleFix":"// before: builder.host(config.host().trim()); // throws if host is empty // after: String h = config.host().trim(); if (!h.isEmpty()) { builder.host(h); }","handlingStrategy":"validation","validationCode":"static String requireHost(String host) {\n    if (host == null) return null; // null is allowed (clears host)\n    String h = host.trim();\n    if (h.isEmpty()) throw new IllegalArgumentException('host must not be blank');\n    return h;\n}","typeGuard":"static boolean isValidHost(String host) {\n    return host == null || !host.isBlank();\n}","tryCatchPattern":"try {\n    builder.host(host);\n} catch (IllegalArgumentException e) {\n    throw new IllegalArgumentException('host was the empty string; expected a hostname or null: ' + host, e);\n}","preventionTips":["Treat blank strings from config as unset and skip the host() call","Prefer URI.getHost() over manual parsing","Trim configured values and substitute a default host when blank"],"tags":["resteasy-reactive","jaxrs","uri","host","illegal-argument"],"backgroundTag":"invalid-uri-host","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}