looris@Palace-of-the-Nine-Moons:/tmp $ bitcoind 
looris@Palace-of-the-Nine-Moons:/tmp $ Bitcoin server starting

EXCEPTION: St13runtime_error       
CLevelDB(): error opening database environment Corruption: missing start of fragmented record(2)       
bitcoin in AppInit()       

This happens when I start bitcoind, any clue on what could I do to fix it?

I tried to run it with -rescan but the result was the same.

  • I suspect it would be faster to redownload the blockchain than fix this, but here's where your error is being thrown from
    – Nick ODell
    Feb 13, 2013 at 23:25
  • 1
    @NickODell doing it, but it takes me more than 24h to download it all, if this bug happens again I'd really need a quicker way to fix it...
    – o0'.
    Feb 13, 2013 at 23:42
  • 1
    Agreed. Actually, this seems more relevant to your problem. It would appear that if it loads a record of type kLastType which isn't preceeded by kFirstType, then it will put out that error message.
    – Nick ODell
    Feb 14, 2013 at 0:04
  • @NickODell oh thank you, that would be useful. Now I'm re-downloading anyway, but I've not deleted the corrupted db yet...
    – o0'.
    Feb 14, 2013 at 9:50
  • 1
    You need -reindex, not -rescan (which is for finding missing wallet transactions). Feb 18, 2013 at 22:28

2 Answers 2


Just run ./bitcoind -reindex and this will fix your problem.

-rescan is for missing wallet transactions


Try to look in the ~/.bitcoin/db.log file for more information. It is likely that your only solution is to remove the block database (either blk0001.dat, blk0002.dat or blkindex.dat). DO NOT REMOVE YOUR wallet.dat file!!!

This means you will have to download the whole block chain again. This other question has tips on how to speed up that download.

Note that this may just be another case of the question asked here.

  • Don't advise people to wipe their data directories. Since 0.8, we have -reindex which rebuilds them without redownloading. Oct 9, 2013 at 17:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.