{"record":{"id":"5787ade192ae9048","repo":"provectus/kafka-ui","slug":"you-specified-password-but-did-not-specify-usernam","errorCode":null,"errorMessage":"You specified password but did not specify username","messagePattern":"You specified password but did not specify username","errorType":"validation","errorClass":"ValidationException","httpStatus":400,"severity":"error","filePath":"kafka-ui-api/src/main/java/com/provectus/kafka/ui/util/WebClientConfigurator.java","lineNumber":106,"sourceCode":"      KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());\n      keyManagerFactory.init(keyStore, keystorePassword.toCharArray());\n      contextBuilder.keyManager(keyManagerFactory);\n    }\n\n    // Create webclient\n    SslContext context = contextBuilder.build();\n\n    httpClient = httpClient.secure(t -> t.sslContext(context));\n    return this;\n  }\n\n  public WebClientConfigurator configureBasicAuth(@Nullable String username, @Nullable String password) {\n    if (username != null && password != null) {\n      builder.defaultHeaders(httpHeaders -> httpHeaders.setBasicAuth(username, password));\n    } else if (username != null) {\n      throw new ValidationException(\"You specified username but did not specify password\");\n    } else if (password != null) {\n      throw new ValidationException(\"You specified password but did not specify username\");\n    }\n    return this;\n  }\n\n  public WebClientConfigurator configureBufferSize(DataSize maxBuffSize) {\n    builder.codecs(c -> c.defaultCodecs().maxInMemorySize((int) maxBuffSize.toBytes()));\n    return this;\n  }\n\n  public WebClientConfigurator configureObjectMapper(ObjectMapper mapper) {\n    builder.codecs(codecs -> {\n      codecs.defaultCodecs()\n          .jackson2JsonEncoder(new Jackson2JsonEncoder(mapper, MediaType.APPLICATION_JSON));\n      codecs.defaultCodecs()\n          .jackson2JsonDecoder(new Jackson2JsonDecoder(mapper, MediaType.APPLICATION_JSON));\n    });\n    return this;\n  }","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/provectus/kafka-ui/blob/83b5a60cc08501b570a0c4d0b4cdfceb1b88d6b7/kafka-ui-api/src/main/java/com/provectus/kafka/ui/util/WebClientConfigurator.java#L88-L124","documentation":"The symmetric case of configureBasicAuth(): a password without a username cannot form HTTP basic credentials, so WebClientConfigurator throws this ValidationException when configureBasicAuth(username=null, password!=null) is called while setting up a WebClient.","triggerScenarios":"Cluster properties set basicAuthPassword for connect/schemaRegistry (or similar) but the corresponding username is missing or empty when the WebClient is configured.","commonSituations":"Username stored in a secret whose key was renamed; config example showing only the password; variable interpolation producing an empty username string.","solutions":["Add the matching username property next to the password in the cluster config","Verify the secret/env interpolation for the username key resolves to a non-empty value","Restart kafka-ui after the config fix"],"exampleFix":"// before\nschemaRegistry:\n  basicAuthPassword: ${SR_PASSWORD}\n// after\nschemaRegistry:\n  basicAuthUsername: ${SR_USERNAME}\n  basicAuthPassword: ${SR_PASSWORD}","handlingStrategy":"validation","validationCode":"if (password != null && username == null) {\n  throw new IllegalArgumentException(\"basicAuthPassword set but basicAuthUsername missing\");\n}","typeGuard":"boolean hasCompleteBasicAuth(String u, String p) { return u != null && p != null; }","tryCatchPattern":"try {\n  webClient = configurator.configureBasicAuth(user, pass).build();\n} catch (ValidationException e) {\n  log.error(\"Incomplete basic auth config: {}\", e.getMessage());\n}","preventionTips":["Group credential pairs in a single secret to prevent partial renders","Assert both keys exist when mounting secrets","Review example configs for both fields before copying"],"tags":["configuration","basic-auth","webclient"],"backgroundTag":"missing-credentials","analyzedSha":"83b5a60cc08501b570a0c4d0b4cdfceb1b88d6b7","analyzedAt":"2026-09-08T04:35:39.002Z","contentChangedAt":"2026-09-08T04:35:39.002Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}