{"record":{"id":"b003cbadb9ce043b","repo":"apache/pulsar","slug":"default-config-can-t-be-deleted","errorCode":null,"errorMessage":"'${DEFAULT_CONFIG}' can't be deleted.","messagePattern":"'(.+?)' can't be deleted\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-client-tools/src/main/java/org/apache/pulsar/shell/config/FileConfigStore.java","lineNumber":106,"sourceCode":"            throw new IllegalArgumentException(\"'\" + DEFAULT_CONFIG + \"' can't be modified.\");\n        }\n        ConfigStore.cleanupValue(entry);\n        fileConfig.configs.put(entry.getName(), entry);\n        write();\n    }\n\n    @Override\n    public ConfigEntry getConfig(String name) {\n        if (DEFAULT_CONFIG.equals(name)) {\n            return defaultConfig;\n        }\n        return fileConfig.configs.get(name);\n    }\n\n    @Override\n    public void deleteConfig(String name) throws IOException{\n        if (DEFAULT_CONFIG.equals(name)) {\n            throw new IllegalArgumentException(\"'\" + DEFAULT_CONFIG + \"' can't be deleted.\");\n        }\n        final ConfigEntry old = fileConfig.configs.remove(name);\n        if (old != null) {\n            write();\n        }\n    }\n\n    @Override\n    public List<ConfigEntry> listConfigs() {\n        List<ConfigEntry> all = new ArrayList<>(fileConfig.configs.values());\n        if (defaultConfig != null) {\n            all.add(0, defaultConfig);\n        }\n        return all;\n    }\n\n    @Override\n    public void setLastUsed(String name) throws IOException {","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-tools/src/main/java/org/apache/pulsar/shell/config/FileConfigStore.java#L88-L124","documentation":"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.","triggerScenarios":"Calling FileConfigStore.deleteConfig(\"default\") (or whatever DEFAULT_CONFIG is set to), e.g. via a pulsar shell 'config delete default' command.","commonSituations":"Users trying to reset their pulsar shell setup by deleting the default profile, or scripted cleanup jobs that iterate all stored configs including 'default'.","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."],"exampleFix":"// before\nstore.deleteConfig(\"default\");\n// after\nif (!\"default\".equals(name)) {\n    store.deleteConfig(name);\n} else {\n    System.out.println(\"Skipping reserved 'default' config\");\n}","handlingStrategy":"validation","validationCode":"if (FileConfigStore.DEFAULT_CONFIG.equals(name)) {\n    throw new IllegalArgumentException(\"Refusing to delete reserved default config\");\n}\nstore.deleteConfig(name);","typeGuard":null,"tryCatchPattern":"try {\n    store.deleteConfig(name);\n} catch (IllegalArgumentException e) {\n    log.warn(\"Cannot delete config '{}': reserved\", name);\n}","preventionTips":["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."],"tags":["configuration","illegal-argument","pulsar-shell"],"backgroundTag":"reserved-config-cannot-be-deleted","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}