migrating legacy wallet “completes”, then removes bitcoin/wallets #34128

issue jestory openend this issue on December 20, 2025
  1. jestory commented at 5:26 pm on December 20, 2025: none

    Is there an existing issue for this?

    • I have searched the existing issues

    Current behaviour

    When I start bitcoin-qt, it says I have a legacy wallet and tells me to migrate it. When I do, a message says that the migration is starting and after a time bitcoin-qt abruptly ends. When I start bitcoin-qt again it says that it cannot find the wallet. On investigating, I see that not only is bitcoin/wallet/wallet.dat gone, but so is the directory bitcoin/wallet.

    Looking at the log, it appears that the migration is successful, then … something happens.

    Expected behaviour

    complete the migration and don’t destroy the wallet.

    Steps to reproduce

    With my legacy wallet.dat, use bitcoin-qt to migrate the legacy wallet.

    Relevant log output

    2025-12-20T16:59:02Z [default wallet] Last client version = 80500 2025-12-20T16:59:02Z [default wallet] Legacy Wallet Keys: 104 plaintext, 0 encrypted, 0 w/ metadata, 104 total. 2025-12-20T16:59:02Z [default wallet] Descriptors: 0, Descriptor Keys: 0 plaintext, 0 encrypted, 0 total. 2025-12-20T16:59:02Z [default wallet] Wallet completed loading in 17ms 2025-12-20T16:59:02Z [default wallet] setKeyPool.size() = 0 2025-12-20T16:59:02Z [default wallet] mapWallet.size() = 14 2025-12-20T16:59:02Z [default wallet] m_address_book.size() = 4 2025-12-20T16:59:02Z copied /mnt/bitcoin/wallets/wallet.dat to /mnt/bitcoin/wallets/default_wallet_1766249942.legacy.bak 2025-12-20T16:59:02Z [default wallet] Migrating wallet storage database from BerkeleyDB to SQLite. 2025-12-20T16:59:02Z Using SQLite Version 3.50.2 2025-12-20T16:59:02Z Using wallet /mnt/bitcoin/wallets 2025-12-20T16:59:02Z [default wallet] Setting spkMan to active: id = 374182aed2e22c1ef37dd8e5b9fd631242f647ae57f05d8b9556d18db013ee47, type = legacy, internal = false 2025-12-20T16:59:02Z [default wallet] Setting spkMan to active: id = ceff5344334331f96f356b6e01c5271441aef08d6e4ee1581cc21c652f42bc86, type = p2sh-segwit, internal = false 2025-12-20T16:59:02Z [default wallet] Setting spkMan to active: id = 155bbeb7f9c67d2d69329fb2a3762c295de656cb81ecda752985e51e8c3c6c79, type = bech32, internal = false 2025-12-20T16:59:02Z [default wallet] Setting spkMan to active: id = 1bd0bae9fcd655a7eefabfa486a4aac06d378caaea4fb18fd3ff82e267f33a5c, type = bech32m, internal = false 2025-12-20T16:59:02Z [default wallet] Setting spkMan to active: id = 7ecccb708fa526705eae8095ab93eb2818c2046f7bc0f16991ce7290ea359751, type = legacy, internal = true 2025-12-20T16:59:02Z [default wallet] Setting spkMan to active: id = 504be46550019ff607ead9e999e4fd08f4c302f7c64275eecadd31189a08d53d, type = p2sh-segwit, internal = true 2025-12-20T16:59:02Z [default wallet] Setting spkMan to active: id = ee394eb8b5666dc08b1ba7d763045043101fead2bf3d2f374a8dceb15efc676c, type = bech32, internal = true 2025-12-20T16:59:02Z [default wallet] Setting spkMan to active: id = 295830f0bdf428f220030af634792d5c40ded7d2b129fc2d185d31d21992bf77, type = bech32m, internal = true 2025-12-20T16:59:02Z [default wallet] Wallet migration complete. 2025-12-20T16:59:02Z [default wallet] Releasing wallet .. 2025-12-20T16:59:02Z Using SQLite Version 3.50.2 2025-12-20T16:59:02Z Using wallet /mnt/bitcoin/wallets 2025-12-20T16:59:02Z init message: Loading wallet… 2025-12-20T16:59:02Z [default wallet] Last client version = 80500 2025-12-20T16:59:03Z [default wallet] Descriptors: 112, Descriptor Keys: 1 plaintext, 0 encrypted, 1 total. 2025-12-20T16:59:03Z [default wallet] Setting spkMan to active: id = 374182aed2e22c1ef37dd8e5b9fd631242f647ae57f05d8b9556d18db013ee47, type = legacy, internal = false 2025-12-20T16:59:03Z [default wallet] Setting spkMan to active: id = ceff5344334331f96f356b6e01c5271441aef08d6e4ee1581cc21c652f42bc86, type = p2sh-segwit, internal = false 2025-12-20T16:59:03Z [default wallet] Setting spkMan to active: id = 155bbeb7f9c67d2d69329fb2a3762c295de656cb81ecda752985e51e8c3c6c79, type = bech32, internal = false 2025-12-20T16:59:03Z [default wallet] Setting spkMan to active: id = 1bd0bae9fcd655a7eefabfa486a4aac06d378caaea4fb18fd3ff82e267f33a5c, type = bech32m, internal = false 2025-12-20T16:59:03Z [default wallet] Setting spkMan to active: id = 7ecccb708fa526705eae8095ab93eb2818c2046f7bc0f16991ce7290ea359751, type = legacy, internal = true 2025-12-20T16:59:03Z [default wallet] Setting spkMan to active: id = 504be46550019ff607ead9e999e4fd08f4c302f7c64275eecadd31189a08d53d, type = p2sh-segwit, internal = true 2025-12-20T16:59:03Z [default wallet] Setting spkMan to active: id = ee394eb8b5666dc08b1ba7d763045043101fead2bf3d2f374a8dceb15efc676c, type = bech32, internal = true 2025-12-20T16:59:03Z [default wallet] Setting spkMan to active: id = 295830f0bdf428f220030af634792d5c40ded7d2b129fc2d185d31d21992bf77, type = bech32m, internal = true 2025-12-20T16:59:03Z [default wallet] Wallet completed loading in 509ms 2025-12-20T16:59:03Z [default wallet] Releasing wallet ..

    2025-12-20T17:07:16Z Bitcoin Core version v30.0.0 (release build) 2025-12-20T17:07:16Z Qt 6.10.1 (dynamic), plugin=xcb 2025-12-20T17:07:16Z No static plugins. 2025-12-20T17:07:16Z Style: fusion / QFusionStyle 2025-12-20T17:07:16Z System: Fedora Linux 43 (Workstation Edition), x86_64-little_endian-lp64 2025-12-20T17:07:16Z Screen: HDMI-0 1920x1080, pixel ratio=1.0 2025-12-20T17:07:16Z GUI: QFSFileEngine::open: No file name specified 2025-12-20T17:07:16Z GUI: QFSFileEngine::open: No file name specified 2025-12-20T17:07:16Z GUI: QFSFileEngine::open: No file name specified 2025-12-20T17:07:16Z GUI: QFSFileEngine::open: No file name specified 2025-12-20T17:07:16Z GUI: QFSFileEngine::open: No file name specified 2025-12-20T17:07:16Z Using the ‘sse4(1way);sse41(4way);avx2(8way)’ SHA256 implementation 2025-12-20T17:07:16Z Using RdSeed as an additional entropy source 2025-12-20T17:07:16Z Using RdRand as an additional entropy source 2025-12-20T17:07:16Z Default data directory /home/jonathans/.bitcoin 2025-12-20T17:07:16Z Using data directory /mnt/bitcoin 2025-12-20T17:07:16Z Config file: /home/jonathans/.bitcoin/bitcoin.conf 2025-12-20T17:07:16Z Config file arg: datadir="/mnt/bitcoin" 2025-12-20T17:07:16Z Config file arg: dbcache=“1024” 2025-12-20T17:07:16Z Config file arg: listen=“1” 2025-12-20T17:07:16Z Config file arg: maxconnections=“40” 2025-12-20T17:07:16Z Config file arg: maxmempool=“300” 2025-12-20T17:07:16Z Config file arg: prune=“550” 2025-12-20T17:07:16Z Config file arg: walletdir="/mnt/bitcoin/wallets" 2025-12-20T17:07:16Z Setting file arg: prune = “3814” 2025-12-20T17:07:16Z Setting file arg: wallet = [""] 2025-12-20T17:07:16Z Using at most 40 automatic connections (1024 file descriptors available) 2025-12-20T17:07:16Z scheduler thread start 2025-12-20T17:07:16Z [error] Specified -walletdir “/mnt/bitcoin/wallets” does not exist 2025-12-20T17:07:29Z Shutdown in progress… 2025-12-20T17:07:29Z scheduler thread exit 2025-12-20T17:07:29Z Shutdown done 2025-12-20T17:07:29Z GUI: QFontDatabase: Must construct a QGuiApplication before accessing QFontDatabase

    How did you obtain Bitcoin Core

    Compiled from source

    What version of Bitcoin Core are you using?

    Bitcoin Core version v30.0.0 (release build)

    Operating system and version

    Fedora Linux 43

    Machine specifications

    Kernel: 6.17.12-300.fc43.x86_64 Windowing system: X11 CPU: Intel i5-10400F CPU @ 2.90 GHz Memory: 62.7 GiB broadband Internet

  2. fanquake added the label Wallet on Dec 20, 2025
  3. achow101 added this to the milestone 31.0 on Dec 20, 2025
  4. achow101 commented at 10:47 pm on December 20, 2025: member
    Are you able to reliably reproduce this issue? I am unable to reproduce the issue both with self compiled and the release binaries.
  5. jestory commented at 2:38 am on December 21, 2025: none

    It is very reliable. I copy my backup wallet.dat to wallets, and when I restart bitcoin-qt, the cycle continues again: I select migrate, the migration appears to complete, based on the log information, then bitcoin-qt quits without any error message, and when I look the wallets directory is gone, with everything in it.

    I have not been able to migrate the legacy wallet.

  6. achow101 commented at 4:03 am on December 21, 2025: member
    Does it happen if you use the release binaries? What about with 29.2?
  7. furszy commented at 3:14 pm on December 21, 2025: member
    As it seems you compiled it yourself, could you attach the debugger and tell us where it crashed? That would speed up the bug-hunting process.
  8. maflcko commented at 12:16 pm on December 22, 2025: member

    I also can’t reproduce this. Do the functional tests pass for you?

    I’ve also written a sketch of a functional test to check this:

     0diff --git a/test/functional/wallet_migration.py b/test/functional/wallet_migration.py
     1index 89989fbf81..1e9bc18bde 100755
     2--- a/test/functional/wallet_migration.py
     3+++ b/test/functional/wallet_migration.py
     4@@ -698,6 +698,47 @@ class WalletMigrationTest(BitcoinTestFramework):
     5         assert (self.master_node.wallets_path / "plainfile").is_dir()
     6         assert (self.master_node.wallets_path / "plainfile" / "wallet.dat").is_file()
     7 
     8+    def test_walletdir_direct_file(self):
     9+        self.log.info("Test migrating a legacy wallet stored as a direct file inside a custom walletdir")
    10+        wallet_name = "walletdir_direct"
    11+        wallet = self.create_legacy_wallet(wallet_name)
    12+        wallet.unloadwallet()
    13+
    14+        wallets_direct = self.master_node.datadir_path / "wallets_direct"
    15+        wallets_direct.mkdir(parents=True, exist_ok=True)
    16+        shutil.copyfile(
    17+            self.old_node.wallets_path / wallet_name / "wallet.dat",
    18+            wallets_direct / wallet_name,
    19+        )
    20+        assert (wallets_direct / wallet_name).is_file()
    21+
    22+        self.restart_node(0, extra_args=[f"-walletdir={wallets_direct}"])
    23+        self.connect_nodes(0, 1)
    24+
    25+        mocked_time = int(time.time())
    26+        self.master_node.setmocktime(mocked_time)
    27+        migrate_res = self.master_node.migratewallet(wallet_name)
    28+        self.master_node.setmocktime(0)
    29+
    30+        assert_equal(migrate_res["wallet_name"], wallet_name)
    31+        migrated_wallet = self.master_node.get_wallet_rpc(wallet_name)
    32+        info = migrated_wallet.getwalletinfo()
    33+        assert_equal(info["descriptors"], True)
    34+        assert_equal(info["format"], "sqlite")
    35+
    36+        assert (wallets_direct / wallet_name).is_dir()
    37+        assert (wallets_direct / wallet_name / "wallet.dat").is_file()
    38+
    39+        self.master_node.unloadwallet(wallet_name, load_on_startup=False)
    40+
    41+        assert False  # passed until now
    42+
    43+        self.restart_node(0, extra_args=self.extra_args[0])
    44+        self.connect_nodes(0, 1)
    45+        if self.default_wallet_name not in self.master_node.listwallets():
    46+            self.master_node.loadwallet(self.default_wallet_name)
    47+        self.sync_all()
    48+
    49     def test_addressbook(self):
    50         df_wallet = self.master_node.get_wallet_rpc(self.default_wallet_name)
    51 
    52@@ -1562,6 +1603,7 @@ class WalletMigrationTest(BitcoinTestFramework):
    53         self.test_wallet_with_path("path/that/ends/in/..")
    54         self.test_default_wallet()
    55         self.test_direct_file()
    56+        self.test_walletdir_direct_file()
    57         self.test_addressbook()
    58         self.test_migrate_raw_p2sh()
    59         self.test_conflict_txs()
    

    It doesn’t fully integrate and pass yet, but the relevant part does pass locally for me.

  9. navneettsinghh commented at 3:12 pm on December 24, 2025: none

    Yes — I can reproduce the issue 100% of the time.

    Steps I follow:

    Copy my known-good legacy wallet.dat into the wallet directory:

    /mnt/bitcoin/wallets/

    Launch bitcoin-qt.

    Bitcoin Core prompts for migration.

    I click Migrate.

    Migration completes according to the log, the new descriptor wallet loads once, and then bitcoin-qt exits abruptly with no GUI error.

    When restarting bitcoin-qt, the entire wallet directory is gone, not just wallet.dat.

    This cycle repeats consistently.

    Key Details Suggesting a Bug

    The log always shows:

    Wallet migration complete. Wallet completed loading… Releasing wallet ..

    Immediately followed by multiple Qt errors:

    GUI: QFSFileEngine::open: No file name specified

    And on the next startup:

    [error] Specified -walletdir “/mnt/bitcoin/wallets” does not exist

    This confirms the directory was deleted after migration, not before.

    Environment Information

    Bitcoin Core: v30.0.0 (compiled from source)

    Qt version: 6.10.1 (dynamic)

    OS: Fedora Linux 43 (X11)

    Kernel: 6.17.12-300.fc43.x86_64

    walletdir: /mnt/bitcoin/wallets mounted on a secondary disk

    Hardware: Intel i5-10400F, 62.7 GiB RAM

    Filesystem: (same as underlying /mnt/bitcoin mount)

    The migration only fails when the wallet directory is on this mounted path. I have not been able to produce a successful migration under any configuration when using this folder.

    What Actually Gets Deleted

    After migration succeeds and the wallet is released, the entire directory /mnt/bitcoin/wallets is missing.

    Inside Bitcoin Core’s log, earlier I can see the backup is made successfully:

    copied wallet.dat to default_wallet_*.legacy.bak

    That backup file also disappears because the directory itself gets removed.

  10. maflcko added the label GUI on Dec 26, 2025
  11. maflcko removed the label GUI on Dec 27, 2025

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-01-01 09:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me