elastic/elasticsearch · error · UserException

78

78

Error message

Setting [{}] does not exist in the keystore.

What it means

Thrown by `show` when the requested setting name is not in the keystore. Exits CONFIG (78). Mirrors the remove-path check: name membership is verified before any read of the underlying bytes.

Source

Thrown at distribution/tools/keystore-cli/src/main/java/org/elasticsearch/cli/keystore/ShowKeyStoreCommand.java:53

    private final OptionSpec<String> arguments;

    public ShowKeyStoreCommand() {
        super("Show a value from the keystore", true);
        this.arguments = parser.nonOptions("setting name");
    }

    @Override
    protected void executeCommand(Terminal terminal, OptionSet options, Environment env) throws Exception {
        final List<String> names = arguments.values(options);
        if (names.size() != 1) {
            throw new UserException(ExitCodes.USAGE, "Must provide a single setting name to show");
        }
        final String settingName = names.get(0);

        final KeyStoreWrapper keyStore = getKeyStore();
        if (keyStore.getSettingNames().contains(settingName) == false) {
            throw new UserException(ExitCodes.CONFIG, "Setting [" + settingName + "] does not exist in the keystore.");
        }

        try (InputStream input = keyStore.getFile(settingName)) {
            final BytesReference bytes = org.elasticsearch.common.io.Streams.readFully(input);
            try {
                byte[] array = BytesReference.toBytes(bytes);
                CharBuffer text = StandardCharsets.UTF_8.newDecoder()
                    .onMalformedInput(CodingErrorAction.REPORT)
                    .onUnmappableCharacter(CodingErrorAction.REPORT)
                    .decode(ByteBuffer.wrap(array));

                // This is not strictly true, but it's the best heuristic we have.
                // Without it we risk appending a newline to a binary file that happens to be valid UTF8
                final boolean isFileOutput = terminal.getOutputStream() != null;
                if (isFileOutput) {
                    terminal.print(Terminal.Verbosity.SILENT, text.toString());
                } else {
                    terminal.println(Terminal.Verbosity.SILENT, text);

View on GitHub (pinned to db6a809a66)

Solutions

  1. Run `list` to see the exact stored names, then `show <exact-name>`.
  2. Confirm you are pointed at the right node's config dir (`ES_PATH_CONF`).
  3. Add the setting via `add-string`/`add-file` if it should exist.
Defensive patterns

Strategy: validation

Validate before calling

if (!keyStore.getSettingNames().contains(settingName)) {
    // not present — skip or add it first
}

Try / catch

try {
    showSetting(name);
} catch (UserException e) {
    if (e.exitCode == ExitCodes.CONFIG) {
        // setting absent — list keystore to find correct name
    }
}

Prevention

When it happens

Trigger: Showing a typo'd or already-removed setting; querying a name from a different node; case mismatch.

Common situations: Debug scripts referencing settings that were never added; checking the wrong config dir's keystore.

Related errors


AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12). Data as JSON: /api/errors/f2c75fde0499ff01. Report an issue: GitHub.