# Error while reading file

**URL:** <https://root-forum.cern.ch/t/error-while-reading-file/33267>\
**Category:** Newbie\
**Created:** [March 21, 2019, 6:12pm UTC](https://root-forum.cern.ch/t/error-while-reading-file/33267 "2019-03-21T18:12:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![newbie1](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/n/ee7513/32.png) [@newbie1](https://root-forum.cern.ch/u/newbie1)\
**Post date:** [March 21, 2019, 6:12pm UTC](https://root-forum.cern.ch/t/error-while-reading-file/33267/1 "2019-03-21T18:12:01Z")

</div>

Hello,

Sorry if my post in not in the right way it should be, this is my first one.

I recently stopped a job which was reading a root file, and I’m sure the file was not properly closed. So, when the job try to read it again, I get this error message:

```auto
_R__unzip: error -5 in inflate (zlib)_
_----- Begin Fatal Exception 21-Mar-2019 18:56:51 CET-----------------------_
_An exception of category 'FileReadError' occurred while_
_ [0] Processing run: 1 lumi: 11518 event: 5472651_
_ [1] Running path 'p'_
_ [2] Calling event method for module MuonFilter/'muonFilter'_
_ [3] Reading branch recoMuons_muons__RECO._
_ Additional Info:_
_ [a] Fatal Root Error: @SUB=TBasket::ReadBasketBuffers_
_fNbytes = 8492, fKeylen = 111, fObjlen = 17444, noutot = 0, nout=0, nin=8381, nbuf=17444_

_----- End Fatal Exception -------------------------------------------------_

```

When I try to recover the file with TFile::Recover(), I get this error message:

```auto
_root [1] _file0->Recover()_
_Error in <TFile::Recover>: Address = 226762245 Nbytes = 0 =====E R R O R=======_
_(Int_t) 0_
_root [2]_

```

My question is, is this file recoverable? If so how could I do that?

Many thanks

---

<div class="post-metadata">

**Author:** ![Danilo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/danilo/32/34528_2.png) [@Danilo](https://root-forum.cern.ch/u/Danilo)\
**Post date:** [March 27, 2019, 9:07am UTC](https://root-forum.cern.ch/t/error-while-reading-file/33267/2 "2019-03-27T09:07:53Z")

</div>

Hi,

it looks like a very corrupted file. I wonder if you can compare its size with the expected one. For all the rest I would refer to CMSSW documentation.

Cheers,  
Danilo

---

<div class="post-metadata">

**Author:** ![newbie1](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/n/ee7513/32.png) [@newbie1](https://root-forum.cern.ch/u/newbie1)\
**Post date:** [March 27, 2019, 4:11pm UTC](https://root-forum.cern.ch/t/error-while-reading-file/33267/3 "2019-03-27T16:11:49Z")

</div>

Hello @Danilo,

Yes it is probably a corrupted file. Before running this jobs it was a good file, but somehow when running the job it became corrupted and I got the

> _R\_\_unzip: error -5 in inflate (zlib)_

error. It happens sometimes when the file is not properly closed (when the job finishes unexpectedly) and I don’t know how to recover it (it that is possible). The workaround I have is to create a new root file (takes some time for that), but I wondered if there was a ROOT method able to recover the corrupted file.

Thanks

---

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [March 29, 2019, 8:16pm UTC](https://root-forum.cern.ch/t/error-while-reading-file/33267/4 "2019-03-29T20:16:34Z")

</div>

> [@newbie1](#):
>
> My question is, is this file recoverable? If so how could I do that?

If Recover fails then there is nothing more we can do (i.e. there is likely missing information in the file).

---

<div class="post-metadata">

**Author:** ![newbie1](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/n/ee7513/32.png) [@newbie1](https://root-forum.cern.ch/u/newbie1)\
**Post date:** [April 10, 2019, 12:45pm UTC](https://root-forum.cern.ch/t/error-while-reading-file/33267/5 "2019-04-10T12:45:51Z")

</div>

Hello @pcanal,

Thanks! That’s what I needed to know.

Cheers
