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
- Skip the default config in your delete logic (guard the call with a name check).
- If you want to reset defaults, edit or overwrite the config file manually rather than deleting the default entry.
- 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
- Filter out 'default' when iterating configs for bulk deletion.
- Treat DEFAULT_CONFIG as immutable in all tooling.
- Reset defaults by overwriting values, not deleting the entry.
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
- configuredService should not be an instance of SystemTopicBa
- Invalid auto split/merge configuration: ${message}
- The shared resource doesn't support thread pool configurati
- No resources have been configured while using shareConfigure
- failoverThreshold must be larger than 0
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/b003cbadb9ce043b.
Report an issue: GitHub.