{"record":{"id":"5a9550745f1cbf28","repo":"quarkusio/quarkus","slug":"prefix-username-and-prefix-password-must-be","errorCode":null,"errorMessage":"${prefix}.username and ${prefix}.password must be both set or both unset","messagePattern":"(.+?)\\.username and (.+?)\\.password must be both set or both unset","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/proxy-registry/runtime/src/main/java/io/quarkus/proxy/runtime/ProxyConfigurationRecorder.java","lineNumber":89,"sourceCode":"            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()));\n                password = Optional.ofNullable(credentials.get(providerConfig.passwordKey()));\n                if (username.isEmpty() || password.isEmpty()) {\n                    StringJoiner missingKeys = new StringJoiner(\" and \");\n                    if (username.isEmpty()) {","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/proxy-registry/runtime/src/main/java/io/quarkus/proxy/runtime/ProxyConfigurationRecorder.java#L71-L107","documentation":"This IllegalStateException is thrown by Quarkus's ProxyConfigurationRecorder during application build when a proxy configuration (quarkus.proxy.\"name\".username / .password) has exactly one of the two credential properties set. Quarkus requires proxy credentials to be either fully configured or fully absent; a half-configured proxy would silently misbehave at runtime, so it fails the build fast instead.","triggerScenarios":"A static init/recorder run at build time where, for a given named proxy prefix, config.username().isPresent() != config.password().isPresent() — i.e. quarkus.proxy.\"my-proxy\".username is set but quarkus.proxy.\"my-proxy\".password is not (or vice versa).","commonSituations":"Setting the username in application.properties and the password via an environment variable or secret that is missing at build time; typos like quarkus.proxy.\"p\".pasword; partially migrating proxy config; a CI environment where only one secret was injected.","solutions":["Set both quarkus.proxy.\"<name>\".username and quarkus.proxy.\"<name>\".password in application.properties (or profile-specific config).","If you did not intend credentials, remove the single username or password property so both are unset.","If credentials come from env vars/secrets, verify the variables are defined in the build-time environment too (proxy config is read at build time by the recorder).","Check for typos in the property keys and confirm you edited the correct Quarkus profile section (%prod, %dev)."],"exampleFix":"// before (application.properties)\nquarkus.proxy.\"corp\".host=proxy.corp.example\nquarkus.proxy.\"corp\".port=8080\nquarkus.proxy.\"corp\".username=svc-user\n\n// after\nquarkus.proxy.\"corp\".host=proxy.corp.example\nquarkus.proxy.\"corp\".port=8080\nquarkus.proxy.\"corp\".username=svc-user\nquarkus.proxy.\"corp\".password=${PROXY_PASSWORD}","handlingStrategy":"validation","validationCode":"// Fail fast in a test or startup check before the build/config validation\nOptional<String> user = configValueFactory(\"quarkus.proxy.\\\"corp\\\".username\");\nOptional<String> pass = configValueFactory(\"quarkus.proxy.\\\"corp\\\".password\");\nif (user.isPresent() != pass.isPresent()) {\n    throw new IllegalArgumentException(\n        \"quarkus.proxy.\\\"corp\\\".username and .password must be both set or both unset\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep username and password adjacent in application.properties so one is never forgotten.","Source credentials from a single mechanism (env var or credentials provider), not a mix.","Add an application.properties lint/test that asserts paired properties are both present or both absent.","Remember proxy config is build-time: verify secrets exist in the CI/build environment, not only at runtime."],"tags":["quarkus","configuration","build-time","proxy","credentials"],"backgroundTag":"incomplete-credentials-config","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"}