Repository navigation
Open
Description
Is there an existing issue for this?
- I have searched the existing issues
Current behaviour
Note: The issue is present in testnet too, not only regtest.
The GUI crashes in regtest immediately on start. It did work once initially but has been crashing since, tried quite a few times.
Expected behaviour
The GUI should not crash in regtest, just like it doesn't in main or test environments.
Steps to reproduce
Regtest conf file to use:
➜ Bitcoin cat $BITCOIN_DATA_DIR/bitcoin-reg.conf
regtest=1
[regtest]
port=28333
rpcport=28332
rpcuser=test
rpcpassword=test
bind=127.0.0.1:28334
bind=127.0.0.1:28335=onionNew data directory setup:
➜ ~ mkdir /tmp/gui-node-1
➜ ~ cp $BITCOIN_DATA_DIR/bitcoin-reg.conf /tmp/gui-node-1
➜ ~ cd /tmp/gui-node-1
➜ gui-node-1 l
total 8
drwxr-xr-x 3 rkrux wheel 96B Dec 19 15:48 .
drwxrwxrwt 10 root wheel 320B Dec 19 15:46 ..
-rw-r--r-- 1 rkrux wheel 123B Dec 19 15:48 bitcoin-reg.confRun GUI (bitcoin-qt): Works first time, no wallet right now.
➜ ~ $BITCOIN_BUILD_BIN_DIR/bitcoin-qt -datadir=/tmp/gui-node-1 -conf=/tmp/gui-node-1/bitcoin-reg.confCreate a wallet within the GUI (wallet name eg: gui-node-wallet) and close the GUI.
Run GUI (bitcoin-qt) again - fails now with the below error:
➜ ~ $BITCOIN_BUILD_BIN_DIR/bitcoin-qt -datadir=/tmp/gui-node-1 -conf=/tmp/gui-node-1/bitcoin-reg.conf
Error: SQLiteDatabase: Failed to configure serialized threading mode: bad parameter or other API misuseData directory state now:
➜ gui-node-1 l /tmp/gui-node-1
total 8
drwxr-xr-x 4 rkrux wheel 128B Dec 19 16:08 .
drwxrwxrwt 10 root wheel 320B Dec 19 16:07 ..
-rw-r--r-- 1 rkrux wheel 123B Dec 19 16:07 bitcoin-reg.conf
drwx------ 13 rkrux wheel 416B Dec 19 16:11 regtest
➜ gui-node-1 l /tmp/gui-node-1/regtest/
total 600
drwx------ 13 rkrux wheel 416B Dec 19 16:11 .
drwxr-xr-x 4 rkrux wheel 128B Dec 19 16:08 ..
-rw------- 1 rkrux wheel 0B Dec 19 16:08 .lock
-rw------- 1 rkrux wheel 37B Dec 19 16:11 anchors.dat
-rw------- 1 rkrux wheel 221B Dec 19 16:08 banlist.json
drwx------ 7 rkrux wheel 224B Dec 19 16:08 blocks
drwx------ 7 rkrux wheel 224B Dec 19 16:10 chainstate
-rw------- 1 rkrux wheel 18K Dec 19 16:11 debug.log
-rw------- 1 rkrux wheel 242K Dec 19 16:11 fee_estimates.dat
-rw------- 1 rkrux wheel 27B Dec 19 16:11 mempool.dat
-rw------- 1 rkrux wheel 4.1K Dec 19 16:11 peers.dat
-rw------- 1 rkrux wheel 242B Dec 19 16:11 settings.json
drwx------ 3 rkrux wheel 96B Dec 19 16:11 wallets
➜ gui-node-1 l /tmp/gui-node-1/regtest/wallets
total 0
drwx------ 3 rkrux wheel 96B Dec 19 16:11 .
drwx------ 13 rkrux wheel 416B Dec 19 16:11 ..
drwx------ 3 rkrux wheel 96B Dec 19 16:11 gui-node-wallet
➜ gui-node-1 l /tmp/gui-node-1/regtest/wallets/gui-node-wallet
total 48
drwx------ 3 rkrux wheel 96B Dec 19 16:11 .
drwx------ 3 rkrux wheel 96B Dec 19 16:11 ..
-rw------- 1 rkrux wheel 24K Dec 19 16:11 wallet.datRelevant log output
2025-12-19T10:48:12Z Using data directory /tmp/gui-node-1/regtest
2025-12-19T10:48:12Z Config file: /tmp/gui-node-1/bitcoin-reg.conf
2025-12-19T10:48:12Z Config file arg: regtest="1"
2025-12-19T10:48:12Z Config file arg: [regtest] bind="127.0.0.1:28334"
2025-12-19T10:48:12Z Config file arg: [regtest] bind="127.0.0.1:28335=onion"
2025-12-19T10:48:12Z Config file arg: [regtest] port="28333"
2025-12-19T10:48:12Z Config file arg: [regtest] rpcpassword=****
2025-12-19T10:48:12Z Config file arg: [regtest] rpcport="28332"
2025-12-19T10:48:12Z Config file arg: [regtest] rpcuser=****
2025-12-19T10:48:12Z Setting file arg: wallet = ["gui-node-wallet"]
2025-12-19T10:48:12Z Command-line arg: conf="/tmp/gui-node-1/bitcoin-reg.conf"
2025-12-19T10:48:12Z Command-line arg: datadir="/tmp/gui-node-1"
2025-12-19T10:48:12Z Using at most 125 automatic connections (1024 file descriptors available)
2025-12-19T10:48:12Z scheduler thread start
2025-12-19T10:48:12Z Using wallet directory /tmp/gui-node-1/regtest/wallets
2025-12-19T10:48:12Z Using SQLite Version 3.43.2
2025-12-19T10:48:12Z init message: Verifying wallet(s)…
2025-12-19T10:48:12Z [warning] SQLite Error. Code: 21. Message: misuse at line 185687 of [1b37c146ee]
2025-12-19T10:48:12Z [error] SQLiteDatabase: Failed to configure serialized threading mode: bad parameter or other API misuse
2025-12-19T10:48:14Z Shutdown in progress...
2025-12-19T10:48:14Z scheduler thread exit
2025-12-19T10:48:14Z Shutdown doneHow did you obtain Bitcoin Core
Compiled from source
What version of Bitcoin Core are you using?
master@13891a8a685d255cb13dd5018e3d5ccc18b07c34
Operating system and version
MacOS Sequoia (15.4)
Machine specifications
No response
Activity
furszy commentedon Dec 17, 2025
Can you check the directory permissions please
maflcko commentedon Dec 17, 2025
Is this really gui-specific? Does it not happen with
bitcoind?rkrux commentedon Dec 18, 2025
Yes, it seems to be GUI specific, and doesn't happen with bitcoind alone.
I did and noticed that the regtest and testnet subdirectories didn't have the r|x permissions for group and others, unlike the data directory. I gave those permissions to them but I don't believe it was the issue - when I was looking into the directory permissions, I also noticed that one regtest subdirectory was present within the regtest subdirectory. I rm-rf'ed it and ran the GUI again, it worked then.
However, the GUI seems to be creating this additional subdirectory every time it is run, and I have to delete it every time, otherwise the same error pops up. If I run the GUI without the
-walletdirargument so that the additional subdirectory is not created, the GUI runs but it is not able to find the already present wallets that I have in regtest, so this argument seems necessary to me, but at the cost of deleting the additional subdirectory after the next run.maflcko commentedon Dec 18, 2025
I don't think
datadiris supposed to include theregtestportion?Otherwise, the dir structure will end with
regtest/regtest, no?maflcko commentedon Dec 18, 2025
At least that is what I get when running:
You are setting regtest in the conf file, so that is different, and it may be good to check what the expected interaction is there:
rkrux commentedon Dec 18, 2025
If I run without the regtest portion, I get the same error. If I run without it and without the
-walletdiras well, then too the same error.I suspect that the GUI always tries to create the regtest subdirectory and errors out if it's already present - at least with my combination of the arguments and configuration file.
rkrux commentedon Dec 18, 2025
From the debug log:
maflcko commentedon Dec 18, 2025
Actually, parsing the conf file should clear the old/stale datadir value:
Can you reproduce this on Linux?
rkrux commentedon Dec 19, 2025
Sorry, I don't have access to a Linux machine.
I will spend some time checking the expected interaction.
maflcko commentedon Dec 19, 2025
Fair. It may be possible to install a Linux VM, but this may be tedious.
Another thing could be to create exact steps to reproduce, starting from a fresh folder:
This way, other devs on macOS can try to reproduce it.
rkrux commentedon Dec 19, 2025
Good idea - done, helped me in understanding the issue from scratch. Also, updating the issue description with these steps.
Regtest conf file to use:
➜ Bitcoin cat $BITCOIN_DATA_DIR/bitcoin-reg.conf regtest=1 [regtest] port=28333 rpcport=28332 rpcuser=test rpcpassword=test bind=127.0.0.1:28334 bind=127.0.0.1:28335=onionNew data directory setup:
Run GUI (bitcoin-qt): Works first time, no wallet right now.
Create a wallet within the GUI (wallet name eg: gui-node-wallet) and close the GUI.
Run GUI (bitcoin-qt) again - fails now with the below error:
Data directory state now:
rkrux commentedon Dec 19, 2025
In the above experiment, I didn't try changing the data dir or adding the walletdir arg so that the issue is apparent with only one set of arguments and dirs. That's why I believe there is no additional regtest subdirectory created.
furszy commentedon Dec 20, 2025
@rkrux, I haven't been able to reproduce it, but have an idea of what might be happening. Please try this branch: https://github.com/furszy/bitcoin-core/tree/2025_wallet_db_config_engine and let me know if the issue still occurs. Will rework the fix properly and detail the scenario.
rkrux commentedon Dec 22, 2025
@furszy Thanks for looking into this, I applied the diff in this commit furszy/bitcoin-core@f01a007 like below:
The error still persists. One thing that I noted earlier and now too is that even while creating the wallet first time, this error is thrown but the GUI doesn't crash. However, upon retrying the creation, the error goes away and the wallet is created. But, later upon restarting the GUI the error is thrown again, crashing the GUI.
furszy commentedon Dec 22, 2025
@rkrux, I assume you can avoid the crash after migration with the following patch:
Yet, this is not a solution. It would only tell us that migration returns an invalid main wallet, which shouldn’t happen. Still, it would give us more information to investigate. Please run it and let me know.
furszy commentedon Dec 22, 2025
A part from what I wrote above, check the following branch and let me know how it goes:
https://github.com/furszy/bitcoin-core/tree/2025_wallet_decouple_db_config
These one should fix the initialization ordering issue (if that is the cause of the crash).
Note: instead of copy pasting the diff as you did above, could fetch from my branch:
(the first commit is the important one, the second one is just #918 (comment))
rkrux commentedon Dec 23, 2025
I tried this and got a fatal crash at the first launch of the GUI.
Cherry-picked the commits as suggested above on latest master:
UI

Terminal State
furszy commentedon Dec 23, 2025
Ok, so it is not a db config ordering issue. Next check.. let's see if your sqlite build was compiled without mutexing support (
SQLITE_THREADSAFE=0). This would also make the serialized config fail.Please drop the previous changes and checkout to this branch (or just cherry-pick this furszy/bitcoin-core@0f9091a).
rkrux commentedon Dec 24, 2025
It didn't abort, the error behaviour remained the same. I tested with testnet as well and the same error in this flow persists there too - so doesn't seem regtest specific; I will update the issue title.
Error:

Cherry-picked commit on master
[-]GUI crashes in regtest[/-][+]GUI crashes on startup after creating a wallet previously[/+]furszy commentedon Dec 26, 2025
@rkrux, the custom configuration path shouldn’t be relevant here (unless you have local permission issues). Also, whether the GUI is used or not should not make any difference (at most, it would only affect whether an uncaught error causes a crash, but nothing else beyond that).
Please try running the release build. If it works as expected, that would point to an issue with your local SQLite setup. In that case, it would be helpful if you could provide more details about how SQLite was installed on your machine and try reinstalling/upgrading it.
rkrux commentedon Dec 29, 2025
@furszy Thanks for the suggestions!
First, I tried with the following command, the same issue persisted:
$BITCOIN_BUILD_BIN_DIR/bitcoin-qt -regtest -datadir=/tmp/gui-node-1Then, I built v30.1 (https://github.com/bitcoin/bitcoin/tree/v30.1) in my system and ran the above command, the issue persisted.
Then, I downloaded the binary from here: https://bitcoincore.org/bin/bitcoin-core-30.0/. This time I don't face the issue and have created multiple wallets since!
IIRC, I didn't install SQLite separately. I am using the one that comes preinstalled in MacOS.
This experiment tells me that there is some issue when I build the binaries in my system but I never faced such an issue while running
bitcoindonly, which is surprising.