apache/pulsar · error · IllegalArgumentException
'${DEFAULT_CONFIG}' can't be modified.
Error message
'${DEFAULT_CONFIG}' can't be modified. What it means
FileConfigStore (the pulsar-shell local config store) reserves the name DEFAULT_CONFIG for built-in defaults. putConfig rejects any ConfigEntry with that name, throwing IllegalArgumentException, so the reserved profile cannot be overwritten; create/use a named profile instead.
Source
Thrown at pulsar-client-tools/src/main/java/org/apache/pulsar/shell/config/FileConfigStore.java:88
try (final BufferedInputStream buffered = new BufferedInputStream(new FileInputStream(file));) {
try {
fileConfig = mapper.readValue(buffered, FileConfig.class);
} catch (MismatchedInputException mismatchedInputException) {
fileConfig = new FileConfig();
}
}
}
private void write() throws IOException {
try (final BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream(file));) {
mapper.writeValue(bufferedOutputStream, fileConfig);
}
}
@Override
public void putConfig(ConfigEntry entry) throws IOException {
if (DEFAULT_CONFIG.equals(entry.getName())) {
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.");View on GitHub (pinned to 820761864e)
Solutions
- Save settings under a named profile, e.g. putConfig with name 'myprofile', then reference that profile at startup.
- Do not attempt to modify the default profile; copy its values into a new named entry and change that.
- Adjust scripts that iterate configs to skip the reserved default entry when writing back.
Example fix
// before
store.putConfig(new ConfigEntry("default", "http://localhost:8080"));
// after
store.putConfig(new ConfigEntry("myprofile", "http://localhost:8080")); Defensive patterns
Strategy: validation
Validate before calling
// Java
if ("default".equalsIgnoreCase(entry.getName())) { throw new IllegalArgumentException("use a named profile, not the default config"); }
store.putConfig(entry); Type guard
function isWritableProfile(name) { return typeof name === 'string' && name.length > 0 && name !== 'default'; } Try / catch
try { store.putConfig(entry); } catch (IllegalArgumentException e) { if (e.getMessage().contains("can't be modified")) { entry = new ConfigEntry("myprofile", entry.getValue()); store.putConfig(entry); } else throw e; } Prevention
- Treat the default config as read-only; always write named profiles.
- Skip the default entry when round-tripping stored configs.
- Keep the profile name in one place in scripts so writes go to your own profile.
When it happens
Trigger: Calling putConfig() with entry.getName() equal to DEFAULT_CONFIG, or via `pulsar-shell --set-config default ...` style commands targeting the reserved profile name.
Common situations: Users trying to edit the implicit 'default' configuration shown by config list; scripts that write settings back under a name read from defaults; tooling that round-trips all config entries including the default one.
Related errors
- Cannot use stdin, -e/--execute-command and -f/--filename opt
- ${paramName} cannot be bigger than <${maxValue}>!
- ${paramName} cannot be less than or equal to <0>!
- The value of ${paramName} can't be empty
- ${name} cannot be less than <${min}>!
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/7db9b48064721c62.
Report an issue: GitHub.