<p>After more than a week of synchronization Bitcoin Core v22 shut down with a fatal error:<code>ERROR: ReadBlockFromDisk: Errors in block header at FlatFilePos(nFile=3058, nPos=104560604)</code>. What could cause this? A malicious peer or is it some hard drive error? I noticed the final two blocks in the <code>blocks</code> directory where very small compared to previous blocks, about 1kb.</p>
<p>I can't start Bitcoin Core anymore due to this error. I really hope I don't have to start downloading the chain from scratch again.</p>
<p>debug.txt</p>
<pre><code>2022-10-22T17:26:30Z Bitcoin Core version v22.0.0 (release build)
2022-10-22T17:26:30Z Qt 5.12.11 (static), plugin=windows (static)
2022-10-22T17:26:30Z Static plugins:
2022-10-22T17:26:30Z  QWindowsIntegrationPlugin, version 330752
2022-10-22T17:26:30Z  QWindowsVistaStylePlugin, version 330752
2022-10-22T17:26:30Z Style: windowsvista / QWindowsVistaStyle
2022-10-22T17:26:30Z System: Windows 10 (10.0), x86_64-little_endian-llp64
2022-10-22T17:26:30Z Screen: \\.\DISPLAY1 960x540, pixel ratio=2.0
2022-10-22T17:26:32Z Assuming ancestors of block 00000000000000000008a89e854d57e5667df88f1cdef6fde2fbca1de5b639ad have valid signatures.
2022-10-22T17:26:32Z Setting nMinimumChainWork=00000000000000000000000000000000000000001fa4663bbbe19f82de910280
2022-10-22T17:26:32Z Using the 'sse4(1way),sse41(4way),avx2(8way)' SHA256 implementation
2022-10-22T17:26:32Z Using RdSeed as additional entropy source
2022-10-22T17:26:32Z Using RdRand as an additional entropy source
2022-10-22T17:26:32Z GUI: &quot;registerShutdownBlockReason: Successfully registered: Bitcoin Core didn't yet exit safely…&quot;
2022-10-22T17:26:32Z Default data directory C:\Users\John Cox\AppData\Roaming\Bitcoin
2022-10-22T17:26:32Z Using data directory D:\bitcoinwin
2022-10-22T17:26:32Z Config file: D:\bitcoinwin\bitcoin.conf (not found, skipping)
2022-10-22T17:26:32Z Using at most 125 automatic connections (2048 file descriptors available)
2022-10-22T17:26:32Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2022-10-22T17:26:32Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2022-10-22T17:26:32Z Script verification uses 3 additional threads
2022-10-22T17:26:32Z scheduler thread start
2022-10-22T17:26:32Z Using wallet directory D:\bitcoinwin
2022-10-22T17:26:32Z init message: Verifying wallet(s)…
2022-10-22T17:26:32Z init message: Loading banlist…
2022-10-22T17:26:32Z SetNetworkActive: true
2022-10-22T17:26:32Z Using /16 prefix for IP bucketing
2022-10-22T17:26:32Z Cache configuration:
2022-10-22T17:26:32Z * Using 2.0 MiB for block index database
2022-10-22T17:26:32Z * Using 8.0 MiB for chain state database
2022-10-22T17:26:32Z * Using 440.0 MiB for in-memory UTXO set (plus up to 286.1 MiB of unused mempool space)
2022-10-22T17:26:32Z init message: Loading block index…
2022-10-22T17:26:32Z Switching active chainstate to Chainstate [ibd] @ height -1 (null)
2022-10-22T17:26:32Z Opening LevelDB in D:\bitcoinwin\blocks\index
2022-10-22T17:26:32Z Opened LevelDB successfully
2022-10-22T17:26:32Z Using obfuscation key for D:\bitcoinwin\blocks\index: 0000000000000000
2022-10-22T17:26:42Z LoadBlockIndexDB: last block file = 3061
2022-10-22T17:26:42Z LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=58, size=80508240, heights=738494...738885, time=2022-05-30...2022-06-01)
2022-10-22T17:26:42Z Checking all blk files are present...
2022-10-22T17:27:52Z Opening LevelDB in D:\bitcoinwin\chainstate
2022-10-22T17:27:52Z Opened LevelDB successfully
2022-10-22T17:27:52Z Using obfuscation key for D:\bitcoinwin\chainstate: 9d9048f3a0cb99bc
2022-10-22T17:27:52Z Loaded best chain: hashBestChain=000000000000000000070b49a59630c7204afdd471641538b41fcb66b120f702 height=738571 date=2022-05-30T12:25:09Z progress=0.960385
2022-10-22T17:27:53Z init message: Verifying blocks…
2022-10-22T17:27:53Z Verifying last 6 blocks at level 3
2022-10-22T17:27:53Z [0%]...[16%]...[33%]...[50%]...[66%]...[83%]...[99%]...[DONE].
2022-10-22T17:28:21Z No coin database inconsistencies in last 6 blocks (11982 transactions)
2022-10-22T17:28:21Z  block index          109846ms
2022-10-22T17:28:21Z loadblk thread start
2022-10-22T17:28:21Z ERROR: ReadBlockFromDisk: Errors in block header at FlatFilePos(nFile=3058, nPos=104560604)
2022-10-22T17:28:21Z *** Failed to read block
2022-10-22T17:28:21Z Error: A fatal internal error occurred, see debug.log for details
</code></pre>

CC BY-SA 4.0
2022-10-22T19:29:36.093Z
1) The last line of your debug.txt says "see debug.log for details" -- are there any? 2) Is there a blk03058.dat in the blocks directory?
RedGrittyBrick
CC BY-SA 4.0
2022-10-22T19:43:28.517Z
yes, I pasted debug logs above. There is a blk3058.dat and it's smaller than the other blk files
I Like
CC BY-SA 4.0
2022-10-22T20:38:17.743Z
Does this answer your question? [special block version or is my data corrupt?](https://bitcoin.stackexchange.com/questions/48798/special-block-version-or-is-my-data-corrupt). The message `"Errors in block header at FlatFilePos(nFile=3058"` suggests to me that `blk03058.dat`" might be corrupt. Maybe as a result of shutting down a computer without waiting for Bitcoin Core to finish closing. Maybe for some other reason.
RedGrittyBrick
CC BY-SA 4.0
2022-10-22T21:44:48.513Z
yes, something must have happened that corrupted the file. Unfortunate to have it happen so close to finishing, but I'll just have to redownload again.
I Like
CC BY-SA 4.0
2022-10-23T08:35:49.360Z
I would delete blk03058.dat and later files then start Bitcoin-core
RedGrittyBrick
CC BY-SA 4.0
2022-10-23T16:39:39.137Z
yeah, I tried that but it wasn't able to rebuild from an earlier block. Luckily, redownloading isn't so bad because I'm using better hardware now
I Like
<bitcoin-core>
During initial synchronization: ERROR: ReadBlockFromDisk: Errors in block header at FlatFilePos
I Like
# During initial synchronization: ERROR: ReadBlockFromDisk: Errors in block header at FlatFilePos

(Asked by: username_0 on 2022-10-22)

After more than a week of synchronization Bitcoin Core v22 shut down with a fatal error:ERROR: ReadBlockFromDisk: Errors in block header at FlatFilePos(nFile=3058, nPos=104560604). What could cause this? A malicious peer or is it some hard drive error? I noticed the final two blocks in the blocks directory where very small compared to previous blocks, about 1kb.
I can't start Bitcoin Core anymore due to this error. I really hope I don't have to start downloading the chain from scratch again.
debug.txt
2022-10-22T17:26:30Z Bitcoin Core version v22.0.0 (release build)
2022-10-22T17:26:30Z Qt 5.12.11 (static), plugin=windows (static)
2022-10-22T17:26:30Z Static plugins:
2022-10-22T17:26:30Z  QWindowsIntegrationPlugin, version 330752
2022-10-22T17:26:30Z  QWindowsVistaStylePlugin, version 330752
2022-10-22T17:26:30Z Style: windowsvista / QWindowsVistaStyle
2022-10-22T17:26:30Z System: Windows 10 (10.0), x86_64-little_endian-llp64
2022-10-22T17:26:30Z Screen: \\.\DISPLAY1 960x540, pixel ratio=2.0
2022-10-22T17:26:32Z Assuming ancestors of block 00000000000000000008a89e854d57e5667df88f1cdef6fde2fbca1de5b639ad have valid signatures.
2022-10-22T17:26:32Z Setting nMinimumChainWork=00000000000000000000000000000000000000001fa4663bbbe19f82de910280
2022-10-22T17:26:32Z Using the 'sse4(1way),sse41(4way),avx2(8way)' SHA256 implementation
2022-10-22T17:26:32Z Using RdSeed as additional entropy source
2022-10-22T17:26:32Z Using RdRand as an additional entropy source
2022-10-22T17:26:32Z GUI: "registerShutdownBlockReason: Successfully registered: Bitcoin Core didn't yet exit safely…"
2022-10-22T17:26:32Z Default data directory C:\Users\John Cox\AppData\Roaming\Bitcoin
2022-10-22T17:26:32Z Using data directory D:\bitcoinwin
2022-10-22T17:26:32Z Config file: D:\bitcoinwin\bitcoin.conf (not found, skipping)
2022-10-22T17:26:32Z Using at most 125 automatic connections (2048 file descriptors available)
2022-10-22T17:26:32Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2022-10-22T17:26:32Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2022-10-22T17:26:32Z Script verification uses 3 additional threads
2022-10-22T17:26:32Z scheduler thread start
2022-10-22T17:26:32Z Using wallet directory D:\bitcoinwin
2022-10-22T17:26:32Z init message: Verifying wallet(s)…
2022-10-22T17:26:32Z init message: Loading banlist…
2022-10-22T17:26:32Z SetNetworkActive: true
2022-10-22T17:26:32Z Using /16 prefix for IP bucketing
2022-10-22T17:26:32Z Cache configuration:
2022-10-22T17:26:32Z * Using 2.0 MiB for block index database
2022-10-22T17:26:32Z * Using 8.0 MiB for chain state database
2022-10-22T17:26:32Z * Using 440.0 MiB for in-memory UTXO set (plus up to 286.1 MiB of unused mempool space)
2022-10-22T17:26:32Z init message: Loading block index…
2022-10-22T17:26:32Z Switching active chainstate to Chainstate [ibd] @ height -1 (null)
2022-10-22T17:26:32Z Opening LevelDB in D:\bitcoinwin\blocks\index
2022-10-22T17:26:32Z Opened LevelDB successfully
2022-10-22T17:26:32Z Using obfuscation key for D:\bitcoinwin\blocks\index: 0000000000000000
2022-10-22T17:26:42Z LoadBlockIndexDB: last block file = 3061
2022-10-22T17:26:42Z LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=58, size=80508240, heights=738494...738885, time=2022-05-30...2022-06-01)
2022-10-22T17:26:42Z Checking all blk files are present...
2022-10-22T17:27:52Z Opening LevelDB in D:\bitcoinwin\chainstate
2022-10-22T17:27:52Z Opened LevelDB successfully
2022-10-22T17:27:52Z Using obfuscation key for D:\bitcoinwin\chainstate: 9d9048f3a0cb99bc
2022-10-22T17:27:52Z Loaded best chain: hashBestChain=000000000000000000070b49a59630c7204afdd471641538b41fcb66b120f702 height=738571 date=2022-05-30T12:25:09Z progress=0.960385
2022-10-22T17:27:53Z init message: Verifying blocks…
2022-10-22T17:27:53Z Verifying last 6 blocks at level 3
2022-10-22T17:27:53Z [0%]...[16%]...[33%]...[50%]...[66%]...[83%]...[99%]...[DONE].
2022-10-22T17:28:21Z No coin database inconsistencies in last 6 blocks (11982 transactions)
2022-10-22T17:28:21Z  block index          109846ms
2022-10-22T17:28:21Z loadblk thread start
2022-10-22T17:28:21Z ERROR: ReadBlockFromDisk: Errors in block header at FlatFilePos(nFile=3058, nPos=104560604)
2022-10-22T17:28:21Z *** Failed to read block
2022-10-22T17:28:21Z Error: A fatal internal error occurred, see debug.log for details

**Tags:** bitcoin-core

> **Comments:**
> **username_1**: 1) The last line of your debug.txt says "see debug.log for details" -- are there any? 2) Is there a blk03058.dat in the blocks directory?  
> **username_0**: yes, I pasted debug logs above. There is a blk3058.dat and it's smaller than the other blk files  
> **username_1**: Does this answer your question? [special block version or is my data corrupt?](https://bitcoin.stackexchange.com/questions/48798/special-block-version-or-is-my-data-corrupt). The message `"Errors in block header at FlatFilePos(nFile=3058"` suggests to me that `blk03058.dat`" might be corrupt. Maybe as a result of shutting down a computer without waiting for Bitcoin Core to finish closing. Maybe for some other reason.  
> **username_0**: yes, something must have happened that corrupted the file. Unfortunate to have it happen so close to finishing, but I'll just have to redownload again.  
> **username_1**: I would delete blk03058.dat and later files then start Bitcoin-core  
> **username_0**: yeah, I tried that but it wasn't able to rebuild from an earlier block. Luckily, redownloading isn't so bad because I'm using better hardware now  

---

## 0 answers

