apache/pulsar · error · IOException

No basic authentication config provided

Error message

No basic authentication config provided

What it means

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.

Source

Thrown at pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationProviderBasic.java:94

        }
    }

    @Override
    public void initialize(ServiceConfiguration config) throws IOException {
        initialize(Context.builder().config(config).build());
    }

    @Override
    public void initialize(Context context) throws IOException {
        authenticationMetrics = new AuthenticationMetrics(context.getOpenTelemetry(),
                getClass().getSimpleName(), getAuthMethodName());
        var config = context.getConfig();
        String data = config.getProperties().getProperty(CONF_PULSAR_PROPERTY_KEY);
        if (StringUtils.isEmpty(data)) {
            data = System.getProperty(CONF_SYSTEM_PROPERTY_KEY);
        }
        if (StringUtils.isEmpty(data)) {
            throw new IOException("No basic authentication config provided");
        }

        @Cleanup BufferedReader reader = null;
        try {
            byte[] bytes = readData(data);
            reader = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(bytes)));
        } catch (Exception e) {
            throw new IllegalArgumentException(e);
        }

        users = new HashMap<>();
        for (String line : reader.lines().toArray(s -> new String[s])) {
            List<String> splitLine = Arrays.asList(line.split(":"));
            if (splitLine.size() != 2) {
                throw new IOException("The format of the password auth conf file is invalid");
            }
            users.put(splitLine.get(0), splitLine.get(1));
        }

View on GitHub (pinned to 820761864e)

Solutions

  1. 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
  2. Confirm the exact property key names CONF_PULSAR_PROPERTY_KEY / CONF_SYSTEM_PROPERTY_KEY from AuthenticationProviderBasic — no typos
  3. Restart the broker/client so initialize() picks up the new property

Example fix

// before (broker.conf)
// authenticationProvider=...AuthenticationProviderBasic  (no credentials configured)
// after
authenticationProvider=org.apache.pulsar.broker.authentication.AuthenticationProviderBasic
<basic-auth-conf-key>=data:{"userId":"admin","password":"secret"}
Defensive patterns

Strategy: validation

Validate before calling

String conf = System.getProperty("pulsar.auth.basic.conf");
if (conf == null || conf.isEmpty()) {
    throw new IllegalStateException("set the basic-auth conf property or system property before init");
}

Try / catch

try {
    provider.initialize(context);
} catch (IOException e) {
    log.error("basic auth not configured: set the conf property", e);
}

Prevention

When it happens

Trigger: 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.

Common situations: Switching authenticationProvider to org.apache.pulsar.broker.authentication.AuthenticationProviderBasic without adding its conf key; property name typo; key lost during config migration.

Understand the failure class

Related errors


AI-assisted analysis of apache/pulsar@820761864e (2026-09-06). Data as JSON: /api/errors/c3e98f518fad8182. Report an issue: GitHub.