{"record":{"id":"2b723cb88cbf3464","repo":"elastic/elasticsearch","slug":"78","errorCode":"78","errorMessage":"Setting [{}] does not exist in the keystore.","messagePattern":"Setting \\[(.+?)\\] does not exist in the keystore\\.","errorType":"exception","errorClass":"UserException","httpStatus":null,"severity":"error","filePath":"distribution/tools/keystore-cli/src/main/java/org/elasticsearch/cli/keystore/RemoveSettingKeyStoreCommand.java","lineNumber":44,"sourceCode":"class RemoveSettingKeyStoreCommand extends BaseKeyStoreCommand {\n\n    private final OptionSpec<String> arguments;\n\n    RemoveSettingKeyStoreCommand() {\n        super(\"Remove settings from the keystore\", true);\n        arguments = parser.nonOptions(\"setting names\");\n    }\n\n    @Override\n    protected void executeCommand(Terminal terminal, OptionSet options, Environment env) throws Exception {\n        List<String> settings = arguments.values(options);\n        if (settings.isEmpty()) {\n            throw new UserException(ExitCodes.USAGE, \"Must supply at least one setting to remove\");\n        }\n        final KeyStoreWrapper keyStore = getKeyStore();\n        for (String setting : arguments.values(options)) {\n            if (keyStore.getSettingNames().contains(setting) == false) {\n                throw new UserException(ExitCodes.CONFIG, \"Setting [\" + setting + \"] does not exist in the keystore.\");\n            }\n            keyStore.remove(setting);\n        }\n        keyStore.save(env.configDir(), getKeyStorePassword().getChars());\n    }\n}\n","sourceCodeStart":26,"sourceCodeEnd":51,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/distribution/tools/keystore-cli/src/main/java/org/elasticsearch/cli/keystore/RemoveSettingKeyStoreCommand.java#L26-L51","documentation":"Thrown by `remove` when a requested setting name is not present in the loaded keystore's setting names. Exits CONFIG (78). It is a per-name check inside the loop; the first missing name aborts the whole operation before `keyStore.save` runs, so nothing is mutated.","triggerScenarios":"Typo in the setting name; removing a setting that was already removed; referencing a name from a different node's keystore; case mismatch.","commonSituations":"Idempotent cleanup scripts that double-delete; copying a remove command from a different cluster.","solutions":["Run `bin/elasticsearch-keystore list` to confirm the exact name before removing.","Make cleanup scripts idempotent by checking membership before calling remove.","Watch for trailing whitespace or quoting differences in the name."],"exampleFix":"// before\nbin/elasticsearch-keystore remove mysetting\n// after\nbin/elasticsearch-keystore list   # confirm exact name\nbin/elasticsearch-keystore remove my.setting","handlingStrategy":"validation","validationCode":"Set<String> present = new HashSet<>(keyStore.getSettingNames());\nfor (String s : settings) {\n    if (!present.contains(s)) {\n        // skip or report, don't call remove\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    removeSetting(name);\n} catch (UserException e) {\n    if (e.exitCode == ExitCodes.CONFIG) {\n        // setting absent — idempotent no-op for cleanup scripts\n    }\n}","preventionTips":["Make cleanup scripts idempotent by checking membership before remove.","Copy exact names from `list` output to avoid typos."],"tags":["elasticsearch","keystore-cli","config","setting-name"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}