As described in #33231 (comment), when InitError() is triggered during initialization, the node prints the error but sometimes continues running, if blockchain data already exists in the datadir.
rm -rfd demo build && mkdir -p demo && cmake -B build && cmake --build build -j$(nproc)
# empty state fails with error
build/bin/bitcoind -datadir=demo -stopatheight=100 -i2psam=invalid_addr
# init state with 10 blocks
build/bin/bitcoind -datadir=demo -stopatheight=1000
# error is shown but doesn't stop execution
build/bin/bitcoind -datadir=demo -i2psam=invalid_addr
the last command does usually stop, but it seems that if the validation is happening too late, it doesn't prevent startup:
2025-09-01T21:46:54Z Bitcoin Core version v29.99.0-7cc9a087069b (release build)
2025-09-01T21:46:54Z Using the 'arm_shani(1way,2way)' SHA256 implementation
2025-09-01T21:46:54Z Default data directory /Users/lorinc/Library/Application Support/Bitcoin
2025-09-01T21:46:54Z Using data directory /Users/lorinc/IdeaProjects/bitcoin/demo
2025-09-01T21:46:54Z Config file: /Users/lorinc/IdeaProjects/bitcoin/demo/bitcoin.conf (not found, skipping)
2025-09-01T21:46:54Z Command-line arg: datadir="demo"
2025-09-01T21:46:54Z Command-line arg: i2psam="invalid_addr"
2025-09-01T21:46:54Z Using at most 125 automatic connections (1024 file descriptors available)
2025-09-01T21:46:54Z Warning: relative datadir option 'demo' specified, which will be interpreted relative to the current working directory '/Users/lorinc/IdeaProjects/bitcoin'. This is fragile, because if bitcoin is started in the future from a different location, it will be unable to locate the current data files. There could also be data loss if bitcoin is started while in a temporary directory.
2025-09-01T21:46:54Z scheduler thread start
2025-09-01T21:46:54Z Binding RPC on address ::1 port 8332
2025-09-01T21:46:54Z Binding RPC on address 127.0.0.1 port 8332
2025-09-01T21:46:54Z Generated RPC authentication cookie /Users/lorinc/IdeaProjects/bitcoin/demo/.cookie
2025-09-01T21:46:54Z Permissions used for cookie: rw-------
2025-09-01T21:46:54Z Using random cookie authentication.
2025-09-01T21:46:54Z Starting HTTP server with 16 worker threads
2025-09-01T21:46:54Z Using wallet directory /Users/lorinc/IdeaProjects/bitcoin/demo
2025-09-01T21:46:54Z init message: Verifying wallet(s)…
2025-09-01T21:46:54Z Using /16 prefix for IP bucketing
2025-09-01T21:46:54Z init message: Loading P2P addresses…
2025-09-01T21:46:54Z Loaded 7172 addresses from peers.dat 9ms
2025-09-01T21:46:54Z init message: Loading banlist…
2025-09-01T21:46:54Z SetNetworkActive: true
2025-09-01T21:46:54Z Cache configuration:
2025-09-01T21:46:54Z * Using 2.0 MiB for block index database
2025-09-01T21:46:54Z * Using 8.0 MiB for chain state database
2025-09-01T21:46:54Z * Using 440.0 MiB for in-memory UTXO set (plus up to 286.1 MiB of unused mempool space)
2025-09-01T21:46:54Z Script verification uses 15 additional threads
2025-09-01T21:46:54Z Using obfuscation key for blocksdir *.dat files (/Users/lorinc/IdeaProjects/bitcoin/demo/blocks): 'b3658ca56bdb3f0c'
2025-09-01T21:46:54Z Opening LevelDB in /Users/lorinc/IdeaProjects/bitcoin/demo/blocks/index
2025-09-01T21:46:54Z Opened LevelDB successfully
2025-09-01T21:46:54Z Using obfuscation key for /Users/lorinc/IdeaProjects/bitcoin/demo/blocks/index: 0000000000000000
2025-09-01T21:46:54Z Using 16 MiB out of 16 MiB requested for signature cache, able to store 524288 elements
2025-09-01T21:46:54Z Using 16 MiB out of 16 MiB requested for script execution cache, able to store 524288 elements
2025-09-01T21:46:54Z init message: Loading block index…
2025-09-01T21:46:54Z Assuming ancestors of block 00000000000000000001b658dd1120e82e66d2790811f89ede9742ada3ed6d77 have valid signatures.
2025-09-01T21:46:54Z Setting nMinimumChainWork=0000000000000000000000000000000000000000b1f3b93b65b16d035a82be84
2025-09-01T21:46:56Z Loading block index db: last block file = 0
2025-09-01T21:46:56Z Loading block index db: last block file info: CBlockFileInfo(blocks=1030, size=236546, heights=0...1041, time=2009-01-03...2009-01-19)
2025-09-01T21:46:56Z Checking all blk files are present...
2025-09-01T21:46:57Z Initializing chainstate Chainstate [ibd] @ height -1 (null)
2025-09-01T21:46:57Z Opening LevelDB in /Users/lorinc/IdeaProjects/bitcoin/demo/chainstate
2025-09-01T21:46:57Z Opened LevelDB successfully
2025-09-01T21:46:57Z Using obfuscation key for /Users/lorinc/IdeaProjects/bitcoin/demo/chainstate: 49bb7fb91842528b
2025-09-01T21:46:57Z Loaded best chain: hashBestChain=00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09 height=1000 date=2009-01-19T06:34:42Z progress=0.000001
2025-09-01T21:46:57Z init message: Verifying blocks…
2025-09-01T21:46:57Z Verifying last 6 blocks at level 3
2025-09-01T21:46:57Z Verification progress: 0%
2025-09-01T21:46:57Z Verification progress: 16%
2025-09-01T21:46:57Z Verification progress: 33%
2025-09-01T21:46:57Z Verification progress: 50%
2025-09-01T21:46:57Z Verification progress: 66%
2025-09-01T21:46:57Z Verification progress: 83%
2025-09-01T21:46:57Z Verification progress: 99%
2025-09-01T21:46:57Z Verification: No coin database inconsistencies in last 6 blocks (6 transactions)
2025-09-01T21:46:57Z Block index and chainstate loaded
2025-09-01T21:46:57Z Setting NODE_NETWORK on non-prune mode
2025-09-01T21:46:57Z block tree size = 912759
2025-09-01T21:46:57Z nBestHeight = 1000
2025-09-01T21:46:57Z initload thread start
2025-09-01T21:46:57Z mapport thread start
2025-09-01T21:46:57Z torcontrol thread start
2025-09-01T21:46:57Z Disabling signature validations at block #1001 (00000000a2887344f8db859e372e7e4bc26b23b9de340f725afbf2edb265b4c6).
2025-09-01T21:46:57Z UpdateTip: new best=00000000a2887344f8db859e372e7e4bc26b23b9de340f725afbf2edb265b4c6 height=1001 version=0x00000001 log2_work=41.968689 tx=1021 date='2009-01-19T06:49:46Z' progress=0.000001 cache=0.3MiB(1txo)
2025-09-01T21:46:57Z UpdateTip: new best=00000000430a20b3f4f658c153168b6615512dfe1a8362602e44a5e11e83011a height=1002 version=0x00000001 log2_work=41.970128 tx=1022 date='2009-01-19T07:08:26Z' progress=0.000001 cache=0.3MiB(2txo)
2025-09-01T21:46:57Z UpdateTip: new best=000000002d5d8c3264d9c6e352b76430cda7a1edac661a515dd1445c15168de5 height=1003 version=0x00000001 log2_work=41.971566 tx=1023 date='2009-01-19T07:26:12Z' progress=0.000001 cache=0.3MiB(3txo)
2025-09-01T21:46:57Z UpdateTip: new best=00000000aded3a9953bb6acd0f51a99ac433369696116a6b72754c672a350a65 height=1004 version=0x00000001 log2_work=41.973002 tx=1024 date='2009-01-19T07:29:12Z' progress=0.000001 cache=0.3MiB(4txo)
2025-09-01T21:46:57Z UpdateTip: new best=000000006659f6eed8840da4336211802af29eb04453e7e92d0f80a98f3e833c height=1005 version=0x00000001 log2_work=41.974437 tx=1025 date='2009-01-19T07:52:03Z' progress=0.000001 cache=0.3MiB(5txo)
2025-09-01T21:46:57Z UpdateTip: new best=00000000c88cb61c8093f11df65dbc6633ae783e6f51be9aa8bbc6c624a994e2 height=1006 version=0x00000001 log2_work=41.975870 tx=1026 date='2009-01-19T08:11:43Z' progress=0.000001 cache=0.3MiB(6txo)
2025-09-01T21:46:57Z UpdateTip: new best=0000000037b9be6143407617d34d7dd70a09aeb68e5da5a092bf5d19d7a06da6 height=1007 version=0x00000001 log2_work=41.977302 tx=1027 date='2009-01-19T08:27:46Z' progress=0.000001 cache=0.3MiB(7txo)
2025-09-01T21:46:57Z UpdateTip: new best=000000005f7e442c07d918a1f2cd4f594f5e1946c22b06ffd7dfe378f59f70e8 height=1008 version=0x00000001 log2_work=41.978732 tx=1028 date='2009-01-19T08:40:20Z' progress=0.000001 cache=0.3MiB(8txo)
2025-09-01T21:46:57Z UpdateTip: new best=000000008bb80b928343bc65ea33b2c97b722d7b85f0470d32a7519d2b7e5550 height=1009 version=0x00000001 log2_work=41.980162 tx=1029 date='2009-01-19T08:52:17Z' progress=0.000001 cache=0.3MiB(9txo)
2025-09-01T21:46:57Z UpdateTip: new best=0000000074679515061a7e8272f315ca6735ee18105e3d4e867cbc87988e2759 height=1010 version=0x00000001 log2_work=41.981589 tx=1030 date='2009-01-19T08:55:07Z' progress=0.000001 cache=0.3MiB(10txo)
2025-09-01T21:46:57Z UpdateTip: new best=00000000bbafcd3677dc5f3c713f464996e0253a2457828d3e775c83191abefc height=1011 version=0x00000001 log2_work=41.983016 tx=1031 date='2009-01-19T09:09:28Z' progress=0.000001 cache=0.3MiB(11txo)
2025-09-01T21:46:57Z UpdateTip: new best=000000002048a8c44e5fcc9b0f19b2ed1fe2c63842ef88c9a29f54607087dc32 height=1012 version=0x00000001 log2_work=41.984440 tx=1032 date='2009-01-19T09:31:02Z' progress=0.000001 cache=0.3MiB(12txo)
2025-09-01T21:46:57Z UpdateTip: new best=00000000f9c20fdda7029f3d5eda156b6b7d4d2b3b8b850b9dea839483e145b6 height=1013 version=0x00000001 log2_work=41.985864 tx=1033 date='2009-01-19T09:46:28Z' progress=0.000001 cache=0.3MiB(13txo)
2025-09-01T21:46:57Z Loading 0 mempool transactions from file...
2025-09-01T21:46:57Z Imported mempool transactions from file: 0 succeeded, 0 failed, 0 expired, 0 already there, 0 waiting for initial broadcast
2025-09-01T21:46:57Z initload thread exit
2025-09-01T21:46:57Z [error] Invalid -i2psam address or hostname: 'invalid_addr'
Error: Invalid -i2psam address or hostname: 'invalid_addr'
2025-09-01T21:46:57Z tor: Thread interrupt
2025-09-01T21:46:57Z Shutdown in progress...
2025-09-01T21:46:57Z torcontrol thread exit
2025-09-01T21:47:00Z mapport thread exit
2025-09-01T21:47:00Z scheduler thread exit
2025-09-01T21:47:00Z Writing 0 mempool transactions to file...
2025-09-01T21:47:00Z Writing 0 unbroadcast transactions to file.
2025-09-01T21:47:00Z Dumped mempool: 0.000s to copy, 0.009s to dump, 27 bytes dumped to file
2025-09-01T21:47:00Z Flushed fee estimates to fee_estimates.dat.
2025-09-01T21:47:00Z Shutdown done
As described in #33231 (comment), when
InitError()is triggered during initialization, the node prints the error but sometimes continues running, if blockchain data already exists in the datadir.the last command does usually stop, but it seems that if the validation is happening too late, it doesn't prevent startup: