apache/pulsar · error · IllegalArgumentException

'${DEFAULT_CONFIG}' can't be deleted.

Error message

'${DEFAULT_CONFIG}' can't be deleted.

What it means

FileConfigStore.deleteConfig refuses to delete the reserved 'default' config entry. The default config is the fallback store entry and deleting it would leave the shell without a base configuration. Any call to deleteConfig with the name equal to the DEFAULT_CONFIG constant throws IllegalArgumentException immediately, before touching the file.

Source

Thrown at pulsar-client-tools/src/main/java/org/apache/pulsar/shell/config/FileConfigStore.java:106

            throw new IllegalArgumentException("'" + DEFAULT_CONFIG + "' can't be modified.");
        }
        ConfigStore.cleanupValue(entry);
        fileConfig.configs.put(entry.getName(), entry);
        write();
    }

    @Override
    public ConfigEntry getConfig(String name) {
        if (DEFAULT_CONFIG.equals(name)) {
            return defaultConfig;
        }
        return fileConfig.configs.get(name);
    }

    @Override
    public void deleteConfig(String name) throws IOException{
        if (DEFAULT_CONFIG.equals(name)) {
            throw new IllegalArgumentException("'" + DEFAULT_CONFIG + "' can't be deleted.");
        }
        final ConfigEntry old = fileConfig.configs.remove(name);
        if (old != null) {
            write();
        }
    }

    @Override
    public List<ConfigEntry> listConfigs() {
        List<ConfigEntry> all = new ArrayList<>(fileConfig.configs.values());
        if (defaultConfig != null) {
            all.add(0, defaultConfig);
        }
        return all;
    }

    @Override
    public void setLastUsed(String name) throws IOException {

View on GitHub (pinned to 820761864e)

Solutions

  1. Skip the default config in your delete logic (guard the call with a name check).
  2. If you want to reset defaults, edit or overwrite the config file manually rather than deleting the default entry.
  3. If 'default' was accidentally created as a user config, rename your profiles to avoid colliding with the reserved name.

Example fix

// before
store.deleteConfig("default");
// after
if (!"default".equals(name)) {
    store.deleteConfig(name);
} else {
    System.out.println("Skipping reserved 'default' config");
}
Defensive patterns

Strategy: validation

Validate before calling

if (FileConfigStore.DEFAULT_CONFIG.equals(name)) {
    throw new IllegalArgumentException("Refusing to delete reserved default config");
}
store.deleteConfig(name);

Try / catch

try {
    store.deleteConfig(name);
} catch (IllegalArgumentException e) {
    log.warn("Cannot delete config '{}': reserved", name);
}

Prevention

When it happens

Trigger: Calling FileConfigStore.deleteConfig("default") (or whatever DEFAULT_CONFIG is set to), e.g. via a pulsar shell 'config delete default' command.

Common situations: Users trying to reset their pulsar shell setup by deleting the default profile, or scripted cleanup jobs that iterate all stored configs including 'default'.

Related errors


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