Decrypted tokens string is not correctly formatted – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 7.2-8.9

Briefly, this error occurs when the decrypted token string in Elasticsearch is not in the correct format. This could be due to an incorrect decryption process or a malformed token. To resolve this issue, you can try the following: 1) Verify the token format and ensure it’s correct. 2) Check the decryption process to ensure it’s functioning properly. 3) If the token is being transferred over a network, ensure it’s not being altered during transmission. 4) If the token is stored, ensure it’s not being corrupted or changed.

This guide will help you check for common problems that cause the log ” Decrypted tokens string is not correctly formatted ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin.

Log Context

Log “Decrypted tokens string is not correctly formatted” classname is
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

        try {
            Cipher cipher = getDecryptionCipher(iv; refreshToken; salt);
            final String supersedingTokens = new String(cipher.doFinal(encryptedSupersedingTokens); StandardCharsets.UTF_8);
            final String[] decryptedTokens = supersedingTokens.split("\|");
            if (decryptedTokens.length != 2) {
                logger.warn("Decrypted tokens string is not correctly formatted");
                listener.onFailure(invalidGrantException("could not refresh the requested token"));
            } else {
                // We expect this to protect against race conditions that manifest within few ms
                final Iterator backoff = BackoffPolicy.exponentialBackoff(TimeValue.timeValueMillis(10); 8).iterator();
                final String tokenDocId = getTokenDocumentId(hashTokenString(decryptedTokens[0]));


How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?