apache/pulsar · error · IllegalArgumentException

Not supported config

Error message

Not supported config

What it means

AuthenticationProviderBasic.readData interprets its configured credential source string: if it starts with 'data:' it is inline JSON, if a readable file path it is read from disk, if base64 it is decoded; otherwise it throws IllegalArgumentException "Not supported config" because the value matches none of the accepted formats.

Source

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

        INVALID_TOKEN,
    }

    @Override
    public void close() throws IOException {
        // noop
    }

    public static byte[] readData(String data)
            throws IOException, URISyntaxException, InstantiationException, IllegalAccessException {
        if (data.startsWith("data:") || data.startsWith("file:")) {
            return IOUtils.toByteArray(URL.createURL(data));
        } else if (Files.exists(Paths.get(data))) {
            return Files.readAllBytes(Paths.get(data));
        } else if (org.apache.commons.codec.binary.Base64.isBase64(data)) {
            return Base64.getDecoder().decode(data);
        } else {
            String msg = "Not supported config";
            throw new IllegalArgumentException(msg);
        }
    }

    @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)) {

View on GitHub (pinned to 820761864e)

Solutions

  1. Prefix inline credentials with 'data:' e.g. data:{"username":"myuser","password":"myp@ss"}
  2. Or point the property to an existing readable JSON file with credentials
  3. Or base64-encode the JSON credentials and supply that string

Example fix

// before
System.setProperty("pulsar.auth.basic.conf", "myuser:mypassword"); // unsupported
// after
System.setProperty("pulsar.auth.basic.conf",
    "data:{\"userId\":\"myuser\",\"password\":\"mypassword\"}");
Defensive patterns

Strategy: validation

Validate before calling

boolean supported(String data) {
    return data.startsWith("data:")
        || java.nio.file.Files.exists(java.nio.file.Paths.get(data))
        || org.apache.commons.codec.binary.Base64.isBase64(data);
}

Try / catch

try {
    provider.initialize(context);
} catch (IOException e) {
    // includes config-not-provided; readData IllegalArgumentException surfaces here too if wrapped
    log.error("basic auth config invalid", e);
}

Prevention

When it happens

Trigger: Setting the basic-auth config property (CONF_PULSAR_PROPERTY_KEY / system property) to a value that is not data:..., an existing file path, or valid base64 — e.g. a bare 'user:password' string or a path to a nonexistent file.

Common situations: Typo in file path; passing a plaintext user:password directly; relative path wrong working directory; copying a config example without the data: prefix.

Related errors


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