{"record":{"id":"75c39d97241f3391","repo":"quarkusio/quarkus","slug":"proxyhost-must-not-be-null-75c39d","errorCode":null,"errorMessage":"proxyHost must not be null","messagePattern":"proxyHost must not be null","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/resteasy-reactive/rest-client/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/RestClientBuilderImpl.java","lineNumber":229,"sourceCode":"        return this;\n    }\n\n    @Override\n    public RestClientBuilderImpl hostnameVerifier(HostnameVerifier hostnameVerifier) {\n        clientBuilder.hostnameVerifier(hostnameVerifier);\n        return this;\n    }\n\n    @Override\n    public RestClientBuilderImpl followRedirects(final boolean follow) {\n        this.followRedirects = follow;\n        return this;\n    }\n\n    @Override\n    public RestClientBuilderImpl proxyAddress(final String proxyHost, final int proxyPort) {\n        if (proxyHost == null) {\n            throw new IllegalArgumentException(\"proxyHost must not be null\");\n        }\n        if ((proxyPort <= 0 || proxyPort > 65535) && !proxyHost.equals(\"none\")) {\n            throw new IllegalArgumentException(\"Invalid port number\");\n        }\n        this.proxyHost = proxyHost;\n        this.proxyPort = proxyPort;\n\n        return this;\n    }\n\n    public RestClientBuilderImpl proxyPassword(String proxyPassword) {\n        this.proxyPassword = proxyPassword;\n        return this;\n    }\n\n    public RestClientBuilderImpl proxyUser(String proxyUser) {\n        this.proxyUser = proxyUser;\n        return this;","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/resteasy-reactive/rest-client/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/RestClientBuilderImpl.java#L211-L247","documentation":"RestClientBuilderImpl.proxyAddress(String, int) validates its arguments before storing them. A null host cannot form a proxy address, so the builder throws IllegalArgumentException 'proxyHost must not be null'. The special host value \"none\" is allowed to disable the proxy.","triggerScenarios":"Calling builder.proxyAddress(null, somePort) directly, or programmatically passing a null host variable sourced from an unset environment/config value.","commonSituations":"Reading proxy host from env/config that is unset and passing it unvalidated; code paths that compute the host conditionally but always call proxyAddress.","solutions":["Pass \"none\" instead of null if you intend to disable the proxy","Guard the call with a null/empty check and skip proxyAddress when no host is configured","Fix the config source so the proxy host env var/property is actually populated"],"exampleFix":"// before\nbuilder.proxyAddress(System.getenv(\"PROXY_HOST\"), 8080);\n// after\nString host = System.getenv(\"PROXY_HOST\");\nif (host != null) {\n    builder.proxyAddress(host, 8080);\n}","handlingStrategy":"validation","validationCode":"String host = config.getProxyHost();\nif (host != null && !host.isBlank()) {\n    builder.proxyAddress(host, config.getProxyPort());\n}","typeGuard":"static boolean isUsableProxyHost(String h) { return h != null && !h.isBlank(); }","tryCatchPattern":"try {\n    builder.proxyAddress(host, port);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"proxyHost must not be null\")) {\n        log.warn(\"No proxy host configured; skipping proxy\");\n    } else throw e;\n}","preventionTips":["Null/blank-check proxy host values sourced from env or config before calling proxyAddress","Use \"none\" as the documented sentinel to disable proxying","Fail fast at startup if a proxy is required but its host is unset"],"tags":["rest-client","proxy","null-argument"],"backgroundTag":"null-argument","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"}