Failure to generate KEK to wrap the DEK dekId – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 7.12-8.6

Briefly, this error occurs when Elasticsearch fails to generate a Key Encryption Key (KEK) to wrap the Data Encryption Key (DEK). This could be due to incorrect configuration or issues with the encryption algorithm. To resolve this, ensure that your encryption settings are correctly configured. Check the encryption algorithm being used and ensure it’s supported. Also, verify that the necessary permissions are in place for the process to generate and use the keys. If the problem persists, consider regenerating your DEK and KEK.

This guide will help you check for common problems that cause the log ” Failure to generate KEK to wrap the DEK [” + dekId + “] ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: repositories, plugin.

Log Context

Log “Failure to generate KEK to wrap the DEK [” + dekId + “]” class name is We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 final SecretKey kek = AESKeyUtils.generatePasswordBasedKey(repositoryPassword; dekId);
 final String kekId = AESKeyUtils.computeId(kek);
 logger.debug("Repository [{}] computed KEK [{}] for DEK [{}]";; kekId; dekId);
 return new Tuple<>(kekId; kek);
 } catch (GeneralSecurityException e) {
 throw new RepositoryException(; "Failure to generate KEK to wrap the DEK [" + dekId + "]"; e);
 }  /**
 * Called before the shard snapshot and finalize operations; on the data and master nodes. This validates that the repository


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?