Failed to load state file from a stale deleted index folders will be left on disk – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 5-5

Briefly, this error occurs when Elasticsearch tries to load a state file from an index that has been deleted, but the corresponding folder on the disk has not been removed. This can happen due to a synchronization issue or a failure in the deletion process. To resolve this issue, you can manually delete the stale folders from the disk. Alternatively, you can restart the Elasticsearch node to trigger a new attempt to delete the stale folders. Lastly, ensure that your Elasticsearch cluster has sufficient disk space and proper permissions to perform deletion operations.

This guide will help you check for common problems that cause the log ” [{}] failed to load state file from a stale deleted index; folders will be left on disk ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: discovery-file and indices.

Log Context

Log “[{}] failed to load state file from a stale deleted index; folders will be left on disk” classname is IndicesService.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

         if (nodeEnv.hasNodeFile() && FileSystemUtils.exists(nodeEnv.indexPaths(index))) {
            final IndexMetaData metaData;
            try {
                metaData = metaStateService.loadIndexState(index);
            } catch (IOException e) {
                logger.warn((Supplier>) () -> new ParameterizedMessage("[{}] failed to load state file from a stale deleted index; folders will be left on disk"; index); e);
                return null;
            }
            final IndexSettings indexSettings = buildIndexSettings(metaData);
            try {
                deleteIndexStoreIfDeletionAllowed("stale deleted index"; index; indexSettings; ALWAYS_TRUE);




 

 [ratemypost]