Wallet picker: An unnamed wallet supported by Core cannot be opened #1004

Open
opened 2026-10-12 05:04:03 +00:00 by jarolrod · 2 comments
jarolrod commented 2026-10-12 05:04:03 +00:00 (Migrated from github.com)

I reproduced an unnamed wallet appearing as a blank “Failed to open wallet” entry. Clicking it doesn't load the wallet, although loadwallet "" false succeeds in the same running application.

To reproduce:

  1. Start a fixture node in a fresh disposable regtest datadir. Create fixture_source and named_wallet with load_on_startup=false.
  2. Use backupwallet on fixture_source to place its backup at <walletdir>/wallet.dat, creating Core's unnamed-wallet layout. Use a fresh wallet directory where this destination does not already exist.
  3. Unload fixture_source. Confirm that Core can load the backup with loadwallet "" false, then unload the unnamed wallet.
  4. Stop the fixture node and wait for it to exit. Start the GUI with the same datadir, RPC enabled and -wallet=named_wallet.
  5. Open the wallet picker and click the unnamed entry.
  6. Run loadwallet "" false through the GUI's RPC server.

The picker showed an empty name and “Failed to open wallet” before and after clicking. RPC then loaded it successfully.

We should give this wallet a usable display name and allow loading it. This is an existing wallet layout supported by Core; it doesn't require creating a new wallet with an empty name.

Tested on qt6 at 09c6de77d7f36bf7fa07c354ebeea51105c447a3, macOS arm64, Qt 6.9.0. I used a real descriptor wallet and the existing offscreen GUI test bridge. This did not test historical wallet-database migration.

Related to the wallet discovery work in #966.

I reproduced an unnamed wallet appearing as a blank “Failed to open wallet” entry. Clicking it doesn't load the wallet, although `loadwallet "" false` succeeds in the same running application. To reproduce: 1. Start a fixture node in a fresh disposable regtest datadir. Create `fixture_source` and `named_wallet` with `load_on_startup=false`. 2. Use `backupwallet` on `fixture_source` to place its backup at `<walletdir>/wallet.dat`, creating Core's unnamed-wallet layout. Use a fresh wallet directory where this destination does not already exist. 3. Unload `fixture_source`. Confirm that Core can load the backup with `loadwallet "" false`, then unload the unnamed wallet. 4. Stop the fixture node and wait for it to exit. Start the GUI with the same datadir, RPC enabled and `-wallet=named_wallet`. 5. Open the wallet picker and click the unnamed entry. 6. Run `loadwallet "" false` through the GUI's RPC server. The picker showed an empty name and “Failed to open wallet” before and after clicking. RPC then loaded it successfully. We should give this wallet a usable display name and allow loading it. This is an existing wallet layout supported by Core; it doesn't require creating a new wallet with an empty name. Tested on `qt6` at `09c6de77d7f36bf7fa07c354ebeea51105c447a3`, macOS arm64, Qt 6.9.0. I used a real descriptor wallet and the existing offscreen GUI test bridge. This did not test historical wallet-database migration. Related to the wallet discovery work in #966.
jarolrod commented 2026-11-06 17:14:10 +00:00 (Migrated from github.com)

Two additional cases extend this beyond opening the unnamed wallet from the picker.

Using the Core-supported wallet whose name is "", with a named wallet also loaded:

  1. Run loadwallet "". QML selects it and shows its correct balance. Choose Close Wallet and confirm. The dialog closes, but listwallets still contains "" and the wallet remains selected. The same Close action works for the named wallet. unloadwallet "" also works through Core RPC.
  2. With the unnamed wallet selected, run getwalletinfo or getbalances in the GUI console. It says Executing command without any wallet and returns error -19 because multiple wallets are loaded. The equivalent command with bitcoin-cli -rpcwallet= succeeds and returns the unnamed wallet.

Closing the named wallet does not fix the unnamed wallet's Close action. Console commands then succeed through Core's single-wallet fallback, but the console still claims to be operating without a wallet.

The picker, Close action and console need to distinguish a valid empty wallet name from no selected wallet. The failure is in GUI identity handling: Core can load, address and unload this wallet correctly.

Reproduced on qt6 at 6e54a48ab571, macOS / Qt 6.9, using an isolated regtest fixture and the offscreen test bridge.

Two additional cases extend this beyond opening the unnamed wallet from the picker. Using the Core-supported wallet whose name is `""`, with a named wallet also loaded: 1. Run `loadwallet ""`. QML selects it and shows its correct balance. Choose **Close Wallet** and confirm. The dialog closes, but `listwallets` still contains `""` and the wallet remains selected. The same Close action works for the named wallet. `unloadwallet ""` also works through Core RPC. 2. With the unnamed wallet selected, run `getwalletinfo` or `getbalances` in the GUI console. It says **Executing command without any wallet** and returns error -19 because multiple wallets are loaded. The equivalent command with `bitcoin-cli -rpcwallet=` succeeds and returns the unnamed wallet. Closing the named wallet does not fix the unnamed wallet's Close action. Console commands then succeed through Core's single-wallet fallback, but the console still claims to be operating without a wallet. The picker, Close action and console need to distinguish a valid empty wallet name from no selected wallet. The failure is in GUI identity handling: Core can load, address and unload this wallet correctly. Reproduced on `qt6` at `6e54a48ab571`, macOS / Qt 6.9, using an isolated regtest fixture and the offscreen test bridge.
jarolrod commented 2026-11-13 14:42:00 +00:00 (Migrated from github.com)

One more case: when the unnamed wallet is a legacy (Berkeley DB) wallet, the app can neither open it nor update it, and there is no loadwallet "" to fall back on.

I placed the same legacy file at <walletdir>/wallet.dat and at <walletdir>/legacyctl/wallet.dat. listwalletdir lists both with the legacy warning, and listwallets is empty at start.

Picker row Before a click After a click
legacyctl no status text "Wallet update required" opens, and Update wallet completes
unnamed "Failed to open wallet" in red nothing: no update prompt, no error, the picker is unchanged

The row's menu → Open wallet does the same as the click. Core treats the two names alike on the same node: loadwallet refuses both with "please use the wallet migration tool", and migratewallet "" succeeds. So the only route for this wallet is the update, and the app never offers it. Bitcoin-Qt's File → Migrate Wallet lists it as "[default wallet]", by its source.

The click stops at the empty-name check, before the legacy branch that opens the update prompt:

github.com/bitcoin-core/gui-qml@2bd5a61e83/qml/walletqmlcontroller.cpp (L1187-L1207)

The update has an empty-name check of its own, so letting the click through would not be enough. I read that from the source; no control reaches it today:

github.com/bitcoin-core/gui-qml@2bd5a61e83/qml/walletqmlcontroller.cpp (L1244-L1249)

A caution for anyone working around this by moving wallet.dat into a named folder: if settings.json lists the unnamed wallet ("wallet": [""]), the node then refuses to start with "Failed to load database path … Data is not in recognized format." With that entry present the app failed to start 9 of 9 times. Remove the entry first.

Reproduced on qt6 at 2bd5a61e8304, macOS arm64 / Qt 6.9.0, isolated regtest, offscreen and native. The picker behaves the same at eed1f426fcb6. The legacy file was built with db_load (one key, unencrypted). I repeated the picker rows offscreen with an unnamed HD wallet written by Bitcoin Core 29.0, with the same result, and migratewallet "" completed on it and on an encrypted one with its passphrase. Clicks went through the test bridge.

One more case: when the unnamed wallet is a legacy (Berkeley DB) wallet, the app can neither open it nor update it, and there is no `loadwallet ""` to fall back on. I placed the same legacy file at `<walletdir>/wallet.dat` and at `<walletdir>/legacyctl/wallet.dat`. `listwalletdir` lists both with the legacy warning, and `listwallets` is empty at start. | Picker row | Before a click | After a click | |---|---|---| | `legacyctl` | no status text | "Wallet update required" opens, and **Update wallet** completes | | unnamed | "Failed to open wallet" in red | nothing: no update prompt, no error, the picker is unchanged | The row's menu → **Open wallet** does the same as the click. Core treats the two names alike on the same node: `loadwallet` refuses both with "please use the wallet migration tool", and `migratewallet ""` succeeds. So the only route for this wallet is the update, and the app never offers it. Bitcoin-Qt's File → Migrate Wallet lists it as "[default wallet]", by its source. The click stops at the empty-name check, before the legacy branch that opens the update prompt: https://github.com/bitcoin-core/gui-qml/blob/2bd5a61e8304d5143e32f1ce977a2de2aceb6413/qml/walletqmlcontroller.cpp#L1187-L1207 The update has an empty-name check of its own, so letting the click through would not be enough. I read that from the source; no control reaches it today: https://github.com/bitcoin-core/gui-qml/blob/2bd5a61e8304d5143e32f1ce977a2de2aceb6413/qml/walletqmlcontroller.cpp#L1244-L1249 A caution for anyone working around this by moving `wallet.dat` into a named folder: if `settings.json` lists the unnamed wallet (`"wallet": [""]`), the node then refuses to start with "Failed to load database path … Data is not in recognized format." With that entry present the app failed to start 9 of 9 times. Remove the entry first. Reproduced on `qt6` at `2bd5a61e8304`, macOS arm64 / Qt 6.9.0, isolated regtest, offscreen and native. The picker behaves the same at `eed1f426fcb6`. The legacy file was built with `db_load` (one key, unencrypted). I repeated the picker rows offscreen with an unnamed HD wallet written by Bitcoin Core 29.0, with the same result, and `migratewallet ""` completed on it and on an encrypted one with its passphrase. Clicks went through the test bridge.
Sign in to join this conversation.
No description provided.