Corrupt file detected source but is set to – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 1.7-1.7

Briefly, this error occurs when Elasticsearch detects a corrupted file during a data recovery or migration process. This could be due to hardware failure, network issues, or a sudden shutdown of the Elasticsearch node. To resolve this issue, you can try the following: 1) Restart the Elasticsearch node, 2) Restore the data from a recent backup, 3) If the corrupted file is a non-critical one, you can delete it and let Elasticsearch rebuild it, 4) Check your hardware or network for any issues and fix them.

This guide will help you check for common problems that cause the log ” corrupt file detected source: [{}] but [{}] is set to [{}] ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: discovery-file and index.

Log Context

Log “corrupt file detected source: [{}] but [{}] is set to [{}]” classname is Engine.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

         if (Lucene.isCorruptionException(t)) {
            if (engineConfig.isFailEngineOnCorruption()) {
                failEngine("corrupt file (source: [" + source + "])"; t);
                return true;
            } else {
                logger.warn("corrupt file detected source: [{}] but [{}] is set to [{}]"; t; source;
                        EngineConfig.INDEX_FAIL_ON_CORRUPTION_SETTING; engineConfig.isFailEngineOnCorruption());
            }
        } else if (ExceptionsHelper.isOOM(t)) {
            failEngine("out of memory (source: [" + source + "])"; t);
            return true;




 

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?