{"record":{"id":"c3e98f518fad8182","repo":"apache/pulsar","slug":"no-basic-authentication-config-provided","errorCode":null,"errorMessage":"No basic authentication config provided","messagePattern":"No basic authentication config provided","errorType":"validation","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationProviderBasic.java","lineNumber":94,"sourceCode":"        }\n    }\n\n    @Override\n    public void initialize(ServiceConfiguration config) throws IOException {\n        initialize(Context.builder().config(config).build());\n    }\n\n    @Override\n    public void initialize(Context context) throws IOException {\n        authenticationMetrics = new AuthenticationMetrics(context.getOpenTelemetry(),\n                getClass().getSimpleName(), getAuthMethodName());\n        var config = context.getConfig();\n        String data = config.getProperties().getProperty(CONF_PULSAR_PROPERTY_KEY);\n        if (StringUtils.isEmpty(data)) {\n            data = System.getProperty(CONF_SYSTEM_PROPERTY_KEY);\n        }\n        if (StringUtils.isEmpty(data)) {\n            throw new IOException(\"No basic authentication config provided\");\n        }\n\n        @Cleanup BufferedReader reader = null;\n        try {\n            byte[] bytes = readData(data);\n            reader = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(bytes)));\n        } catch (Exception e) {\n            throw new IllegalArgumentException(e);\n        }\n\n        users = new HashMap<>();\n        for (String line : reader.lines().toArray(s -> new String[s])) {\n            List<String> splitLine = Arrays.asList(line.split(\":\"));\n            if (splitLine.size() != 2) {\n                throw new IOException(\"The format of the password auth conf file is invalid\");\n            }\n            users.put(splitLine.get(0), splitLine.get(1));\n        }","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationProviderBasic.java#L76-L112","documentation":"AuthenticationProviderBasic.initialize() needs credentials from configuration property CONF_PULSAR_PROPERTY_KEY (pulsar.auth.basic.conf) or the corresponding system property. If both are empty, initialization fails with IOException \"No basic authentication config provided\" because the provider has nothing to authenticate against.","triggerScenarios":"Initializing the basic authentication provider without setting the config property or the system property — e.g. broker.conf missing authenticationData/basic-auth settings or the JVM launched without -D flags.","commonSituations":"Switching authenticationProvider to org.apache.pulsar.broker.authentication.AuthenticationProviderBasic without adding its conf key; property name typo; key lost during config migration.","solutions":["Set the config property (e.g. in broker.conf: the basic-auth conf key pointing to data:/file/base64 credentials) or pass -D<system-property-key>=... to the JVM","Confirm the exact property key names CONF_PULSAR_PROPERTY_KEY / CONF_SYSTEM_PROPERTY_KEY from AuthenticationProviderBasic — no typos","Restart the broker/client so initialize() picks up the new property"],"exampleFix":"// before (broker.conf)\n// authenticationProvider=...AuthenticationProviderBasic  (no credentials configured)\n// after\nauthenticationProvider=org.apache.pulsar.broker.authentication.AuthenticationProviderBasic\n<basic-auth-conf-key>=data:{\"userId\":\"admin\",\"password\":\"secret\"}","handlingStrategy":"validation","validationCode":"String conf = System.getProperty(\"pulsar.auth.basic.conf\");\nif (conf == null || conf.isEmpty()) {\n    throw new IllegalStateException(\"set the basic-auth conf property or system property before init\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    provider.initialize(context);\n} catch (IOException e) {\n    log.error(\"basic auth not configured: set the conf property\", e);\n}","preventionTips":["Always pair authenticationProvider=...Basic with its conf key","Use startup config validation to catch missing keys early","Document required properties in deployment templates"],"tags":["authentication","configuration","basic-auth","missing-config"],"backgroundTag":"missing-config-key","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}