{"record":{"id":"cec0d2d3a5bffdc1","repo":"quarkusio/quarkus","slug":"if-prefix-host-is-set-prefix-port-must-also","errorCode":null,"errorMessage":"If ${prefix}.host is set, ${prefix}.port must also be set","messagePattern":"If (.+?)\\.host is set, (.+?)\\.port must also be set","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/proxy-registry/runtime/src/main/java/io/quarkus/proxy/runtime/ProxyConfigurationRecorder.java","lineNumber":85,"sourceCode":"            }\n            if (config.password().isPresent()) {\n                badValues.add(\"password\");\n            }\n            if (config.nonProxyHosts().isPresent()) {\n                badValues.add(\"non-proxy-hosts\");\n            }\n            if (config.proxyConnectTimeout().isPresent()) {\n                badValues.add(\"proxy-connect-timeout\");\n            }\n            if (badValues.length() > 0) {\n                throw new IllegalStateException(\n                        \"If \" + prefix + \".host is not set, then all of \" + badValues + \" must not be set either\");\n            }\n            return Optional.empty();\n        }\n\n        if (config.port().isEmpty()) {\n            throw new IllegalStateException(\"If \" + prefix + \".host is set, \" + prefix + \".port must also be set\");\n        }\n\n        if (config.username().isPresent() != config.password().isPresent()) {\n            throw new IllegalStateException(prefix + \".username and \" + prefix + \".password must be both set or both unset\");\n        }\n\n        Optional<String> username;\n        Optional<String> password;\n        if (config.username().isPresent() && config.password().isPresent()) {\n            username = config.username();\n            password = config.password();\n        } else {\n            ProxyConfig.ProxyCredentialProviderConfig providerConfig = config.credentialsProvider();\n            if (providerConfig.name().isPresent()) {\n                CredentialsProvider provider = CredentialsProviderFinder.find(providerConfig.beanName().orElse(null));\n                Map<String, String> credentials = provider.getCredentialsAsync(providerConfig.name().get())\n                        .await().indefinitely();\n                username = Optional.ofNullable(credentials.get(providerConfig.usernameKey()));","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/proxy-registry/runtime/src/main/java/io/quarkus/proxy/runtime/ProxyConfigurationRecorder.java#L67-L103","documentation":"Thrown by ProxyConfigurationRecorder.build when a proxy block defines a port (and possibly other companion settings) without the corresponding host. The recorder validates each configured proxy prefix: host is the anchor property that activates the proxy, and setting port/user/password/non-proxy-hosts/timeouts without it produces an inconsistent configuration, so the guard aborts startup rather than registering a host-less proxy.","triggerScenarios":"Setting quarkus.proxy.\"<name>\".host=proxy.example.com (or the default quarkus.proxy.host) without a corresponding .port property at startup.","commonSituations":"Assuming a default port (8080/3128) is applied automatically; partial config from environment variables where the port var is missing; hand-written blocks omitting port.","solutions":["Add the port: quarkus.proxy.\"<name>\".port=<port> next to the host property","If no proxy is wanted, remove the host property (and any sibling keys) entirely","Verify env var form is correct, e.g. QUARKS_PROXY__NAME__PORT for named configs (QUARKUS_PROXY__NAME__PORT)"],"exampleFix":"// before\nquarkus.proxy.\"x\".host=proxy.example.com\n// after\nquarkus.proxy.\"x\".host=proxy.example.com\nquarkus.proxy.\"x\".port=8080","handlingStrategy":"validation","validationCode":"if (config.getOptionalValue(\"quarkus.proxy.\\\"x\\\".host\", String.class).isPresent()\n    && config.getOptionalValue(\"quarkus.proxy.\\\"x\\\".port\", Integer.class).isEmpty()) {\n    throw new IllegalArgumentException(\"quarkus.proxy.\\\"x\\\".port is required when host is set\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    application.start();\n} catch (IllegalStateException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\".port must also be set\")) {\n        throw new IllegalStateException(\"Add the matching quarkus.proxy.*.port property\", e);\n    }\n    throw e;\n}","preventionTips":["Always set host and port as a pair","Verify port env vars exist in container/CI environments","Do not assume a default port is applied","Include proxy config validation in startup tests"],"tags":["proxy","configuration","startup","validation"],"backgroundTag":"incomplete-proxy-configuration","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"}