# org.apache.lucene.index.CorruptIndexException: codec footer mismatch (file truncated?)

**URL:** <https://discuss.elastic.co/t/org-apache-lucene-index-corruptindexexception-codec-footer-mismatch-file-truncated/254517>\
**Category:** Elasticsearch\
**Created:** [November 6, 2020, 10:42am UTC](https://discuss.elastic.co/t/org-apache-lucene-index-corruptindexexception-codec-footer-mismatch-file-truncated/254517 "2020-11-06T10:42:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tin\_Deng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tin_deng/32/78545_2.png) [@Tin\_Deng](https://discuss.elastic.co/u/Tin_Deng)\
**Post date:** [November 6, 2020, 10:42am UTC](https://discuss.elastic.co/t/org-apache-lucene-index-corruptindexexception-codec-footer-mismatch-file-truncated/254517/1 "2020-11-06T10:42:33Z")

</div>

ES version: 5.6.8  
1 master, 3 data nodes, replica = 0

Hi everyone,

I was wondering if it's possible to recover the data with the exception in this case?

```auto
Caused by: org.elasticsearch.gateway.CorruptStateException: org.apache.lucene.index.CorruptIndexException: codec footer mismatch (file truncated?): actual footer=1952260187 vs expected footer=-1071082520 (resource=BufferedChecksumIndexInput(SimpleFSIndexInput(path="Z:\es\es3\data\nodes\0\indices\C0Vq5v8NSnKUzV-BqybsIg\_state\state-79.st")))
	at org.elasticsearch.gateway.MetaDataStateFormat.read(MetaDataStateFormat.java:207) ~[elasticsearch-5.6.8.jar:5.6.8]
	at org.elasticsearch.gateway.MetaDataStateFormat.loadLatestState(MetaDataStateFormat.java:322) ~[elasticsearch-5.6.8.jar:5.6.8]
	... 37 more
Caused by: org.apache.lucene.index.CorruptIndexException: codec footer mismatch (file truncated?): actual footer=1952260187 vs expected footer=-1071082520 (resource=BufferedChecksumIndexInput(SimpleFSIndexInput(path="Z:\es\es3\data\nodes\0\indices\C0Vq5v8NSnKUzV-BqybsIg\_state\state-79.st")))
	at org.apache.lucene.codecs.CodecUtil.validateFooter(CodecUtil.java:502) ~[lucene-core-6.6.1.jar:6.6.1 9aa465a89b64ff2dabe7b4d50c472de32c298683 - varunthacker - 2017-08-29 21:54:39]
	at org.apache.lucene.codecs.CodecUtil.checkFooter(CodecUtil.java:414) ~[lucene-core-6.6.1.jar:6.6.1 9aa465a89b64ff2dabe7b4d50c472de32c298683 - varunthacker - 2017-08-29 21:54:39]
	at org.apache.lucene.codecs.CodecUtil.checksumEntireFile(CodecUtil.java:526) ~[lucene-core-6.6.1.jar:6.6.1 9aa465a89b64ff2dabe7b4d50c472de32c298683 - varunthacker - 2017-08-29 21:54:39]
	at org.elasticsearch.gateway.MetaDataStateFormat.read(MetaDataStateFormat.java:189) ~[elasticsearch-5.6.8.jar:5.6.8]
	at org.elasticsearch.gateway.MetaDataStateFormat.loadLatestState(MetaDataStateFormat.java:322) ~[elasticsearch-5.6.8.jar:5.6.8]

```

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [November 6, 2020, 1:06pm UTC](https://discuss.elastic.co/t/org-apache-lucene-index-corruptindexexception-codec-footer-mismatch-file-truncated/254517/2 "2020-11-06T13:06:53Z")

</div>

> [@Tin\_Deng](#):
>
> I was wondering if it's possible to recover the data with the exception in this case?

No, sadly this means it is unrecoverable. By default Elasticsearch would recover it from a replica, but you have disabled this option. Your best bet is to restore it from a recent snapshot.

---

<div class="post-metadata">

**Author:** ![Tin\_Deng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tin_deng/32/78545_2.png) [@Tin\_Deng](https://discuss.elastic.co/u/Tin_Deng)\
**Post date:** [November 6, 2020, 1:34pm UTC](https://discuss.elastic.co/t/org-apache-lucene-index-corruptindexexception-codec-footer-mismatch-file-truncated/254517/3 "2020-11-06T13:34:38Z")

</div>

Hi David,

Thank you for the response, I will try to recover from the snapshot 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 4, 2020, 1:34pm UTC](https://discuss.elastic.co/t/org-apache-lucene-index-corruptindexexception-codec-footer-mismatch-file-truncated/254517/4 "2020-12-04T13:34:39Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
