cryptoadvance / specter-desktop

A desktop GUI for Bitcoin Core optimised to work with hardware wallets
MIT License
793 stars 236 forks source link

Error: Failed to load utxos, IndexError: list index out of range ✕ #2335

Open runjam1 opened 1 year ago

runjam1 commented 1 year ago

Screenshot (17) When I click on a wallet to open it I get this error message:

Failed to load utxos, IndexError: list index out of range ✕

CryptoCase commented 1 year ago

I am having this same issue. This did not happen on the previous Spectre versions, after updating I am now unable to access my wallets due to this issue even after rescanning and resyncing with the blockchain.

FYI it's happening mainly for multi sig wallets.

moneymanolis commented 1 year ago

Would be good to have more context on how to reproduce it. Any logs / hints appreciated.

BTW, the above error in the OP is sth else. This happens if you try to create a hot wallet with the same name again. (deleting the hot wallet in Specter does not delete it on the node).

eugenenz commented 1 year ago

Hi, I posted about this issue on Telegram and just adding some information here...

The error that I'm getting is [2023-07-03 21:21:26,679] ERROR in wallet: list index out of range Traceback (most recent call last): File "..../specter-desktop/src/cryptoadvance/specter/wallet/wallet.py", line 727, in check_utxo searched_vout = [ ^ IndexError: list index out of range [2023-07-03 21:21:26,680] ERROR in wallet_manager: Failed to load utxos, IndexError: list index out of range Traceback (most recent call last): File "..../specter-desktop/src/cryptoadvance/specter/wallet/wallet.py", line 727, in check_utxo searched_vout = [ ^ IndexError: list index out of range

Looking at the source code, the error comes from wallet.py, lines 718-725.

Running bitcoin-cli listlockunspent on my node returns the following:

[ { "txid": "ID1", "vout": 0 } ]

Details of that transaction returned by the bitcoin-cli gettransaction ID1 command have a details object where vout == 1.

tx_from_core holds the ID1 transaction with vout == 1 but the utxo_voutthat it filters by is == 0, so the searched_vout won’t be found.

Some more context on my error: it's a 2-3 multisig wallet. I dug out local Specter logs and found some more details that could be relevant. Shortly before the multisig wallet stopped loading with the above error, I see a warning in the log: WARNING in wallet: Request error for method lockunspent(True, [{'txid': 'ID2', 'vout': 1}]): Invalid parameter, expected unspent output.

ID2 refers to a transaction that I sent before ID1 was created from my single sig wallet to the multisig wallet and which confirmed successfully. I also remember selecting the UTXO that I got from that transaction, and there is a chance that it was selected when I created a PSBT that would result in ID1 transaction. Could that have led to some kind of mix-up?

When I restart bitcoin-core and then restart specter, it displays a message Re-locking UTXOs of wallet <xxx> and again displays the txid ID1 which is no longer a PSBT but a confirmed and verified transaction.

Just to re-iterate:

ID2 -> first transaction, from single sig to Specter multisig Specter tries to lock unsuccessfully ID1 -> a multisig transaction that's been confirmed, but Specter still seems to see it as pending/partially signed.

moneymanolis commented 1 year ago

Just so that I can reproduce:

You sent a tx from your singlesig wallet to a multisig wallet. Then, you used this exact UTXO to send from the multisig wallet to somewhere else (?) and then the error began?

eugenenz commented 1 year ago

Having throught about it, I don't actually think I used this exact UTXO in the end, as the amounts differ, but I remember selecting and unselecting it. But otherwise yes, after I received a transaction from my singlesig, I created a multi-sig transaction using Specter and sent it to a Muun wallet. Then the error message showed up attempting to lock my first transaction (and getting an error), and the multisig couldn't load following that. Does this make sense? Thanks with helping out with this. 👍

moneymanolis commented 1 year ago

So, you sent a tx from a singlesig wallet to your multisig wallet in Specter. Then, you sent from this multisig wallet to somewhere. Mhh, not sure yet, what caused the issue then. If you could replicate it on testnet or regtest, that would extremely helpful.

eugenenz commented 1 year ago

Apologies, somehow I missed your reply over the weekend. I double-checked the mempool and can confirm that the initial scenario was correct: I used the same UTXO in my multisig wallet that I received from my initial transaction, and somehow that led to the mix-up.

I'll try to replicate it in the meantime and will keep updating here!

moneymanolis commented 1 year ago

Ideally, do it on testnet, but it takes some to setup a testnet node on your laptop. Regtest is also fine.

pcliff069 commented 1 year ago

further to telegram. all I can give is an anecdotal. I was doing a send from my multisig wallet. PSBT was signed by Coldcard MK4 no issues, Somehow I got back to Specter and opened the Single Sig wallet and tried to post the signed PSBT. It obviously failed - I think it took me another go at it to realise my (stupidity) mistake. I then posted in correct wallet. Next time I opened Specter got the index error. Loaded another wallet with same info. All looked good until I tried to start a send - Index error again, this was a PSBT send. Loaded another wallet - again all looked good. This time I tried a send from UTXO. This time I signed (2/4) via Ledger and Bitcoin Core hot wallet. This went - and all wallets restored. Unfort. I cannot send logs. Hope this helps and I remembered the sequence correctly.

moneymanolis commented 1 year ago

@pcliff069 thanks for that. Definitely helps to reproduce it.

pcliff069 commented 1 year ago

Glad it helped. Just for the record everything A1 with my Specter DT.

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Manolis Mandrapilias @.> Sent: Friday, August 18, 2023 6:24:19 PM To: cryptoadvance/specter-desktop @.> Cc: Paul CLifford @.>; Mention @.> Subject: Re: [cryptoadvance/specter-desktop] Error: Failed to load utxos, IndexError: list index out of range ✕ (Issue #2335)

@pcliff069https://github.com/pcliff069 thanks for that. Definitely helps to reproduce it.

— Reply to this email directly, view it on GitHubhttps://github.com/cryptoadvance/specter-desktop/issues/2335#issuecomment-1683775593, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AG7DLQ3OVBJ63RW3OQZXVP3XV5GGHANCNFSM6AAAAAAYERY3FI. You are receiving this because you were mentioned.Message ID: @.***>

nolith commented 1 year ago

I got the same "Failed to load utxos, IndexError: list index out of range" on testnet every time I try to open my hot wallet.

  1. I had 2 UXTO on the wallet and selected one to send to my multisig lowering the amount to generate a change address
  2. made another tx from hot to multisig using the other UXTO
  3. made a final tx using the change address from tx one to multisig (at that point in time I had 2-3 confirmations)

After clicking the "sign with bitcoin core" button the error showed up and the wallet cannot be opened again.

I hope this helps reproducing the problem

pcliff069 commented 1 year ago

Bit more information for you. Today I was doing a MultiSig send. It is the only wallet I now have on Specter. First send, using Coldcard and Ledger no issues. Second send. First sign Coldcard no problem. Second using Bitcoin core, error.

Hope that helps.

Regards

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Manolis Mandrapilias @.> Sent: Friday, August 18, 2023 6:24:19 PM To: cryptoadvance/specter-desktop @.> Cc: Paul CLifford @.>; Mention @.> Subject: Re: [cryptoadvance/specter-desktop] Error: Failed to load utxos, IndexError: list index out of range ✕ (Issue #2335)

@pcliff069https://github.com/pcliff069 thanks for that. Definitely helps to reproduce it.

— Reply to this email directly, view it on GitHubhttps://github.com/cryptoadvance/specter-desktop/issues/2335#issuecomment-1683775593, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AG7DLQ3OVBJ63RW3OQZXVP3XV5GGHANCNFSM6AAAAAAYERY3FI. You are receiving this because you were mentioned.Message ID: @.***>

alvistar commented 9 months ago

Hello, I had the same error and I am also experiencing issue trying to recreate the wallet on Macos 2.0.2

Here is what I have got: ERROR in wallet_importer: new range must include current range = [0,1008] and new range must include current range = [0,1000]

I am re-importing the same wallet on a new ubuntu vm and it looks that is working (now rescanning). I am unable to import again in Macos.

I both tried to delete wallet on bitcoin core and locally.

Any suggestion? (beside wiping all specter data)

ironrai commented 6 months ago

The same error here was generated by giving my wife a demo on how to use the wallet, I only closed the transaction without signing and from there cannot enter the wallet anymore, the only solution was to physically delete the wallet folder in Bitcoin core and reimport it with another name, because with the same name it also fails with the following error:

ERROR in wallet_importer: new range must include current range = [0,1001] and new range must include current range = [0,1000] Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/cryptoadvance/specter/util/wallet_importer.py", line 235, in create_wallet self.wallet = wallet_manager.create_wallet( File "/usr/local/lib/python3.10/site-packages/cryptoadvance/specter/managers/wallet_manager.py", line 353, in create_wallet w = self.WalletClass.create( File "/usr/local/lib/python3.10/site-packages/cryptoadvance/specter/wallet/wallet.py", line 362, in create raise SpecterError(all_issues) cryptoadvance.specter.specter_error.SpecterError: new range must include current range = [0,1001] and new range must include current range = [0,1000]

moneymanolis commented 6 months ago

Thanks guys for reporting!

aphex3k commented 4 months ago

+1

Version 2.0.2 <redacted wallet name> is a multi-sig wallet

I was constructing a multi-sig transaction with coin control (manual utxo selection) and signed with the first key. Before signing with the second key the error showed up.

2024-04-30 15:57:46.438056-07:00[2024-04-30 22:57:46,437] INFO in controller: GET, /wallets/wallet/<redacted wallet name>/       , 302, took,    0, ms
2024-04-30 15:57:47.268237-07:00[2024-04-30 22:57:47,267] ERROR in wallet: list index out of range
2024-04-30 15:57:47.268273-07:00Traceback (most recent call last):
2024-04-30 15:57:47.268282-07:00File "/usr/local/lib/python3.10/site-packages/cryptoadvance/specter/wallet/wallet.py", line 721, in check_utxo
2024-04-30 15:57:47.268342-07:00searched_vout = [
2024-04-30 15:57:47.268354-07:00IndexError: list index out of range
2024-04-30 15:57:47.268507-07:00[2024-04-30 22:57:47,268] INFO in wallet_manager: starting update of wallet_manager (threading: True , comment: via server_specter_error)
2024-04-30 15:57:47.272606-07:00[2024-04-30 22:57:47,272] INFO in controller: GET, /wallets/wallet/<redacted wallet name>/history/, 302, took,  823, ms
2024-04-30 15:57:47.294654-07:00[2024-04-30 22:57:47,294] INFO in controller: GET, /welcome/about                          , 200, took,   12, ms
2024-04-30 15:57:47.382098-07:00[2024-04-30 22:57:47,381] INFO in controller: GET, /wallets/wallets_loading/               , 200, took,    0, ms
2024-04-30 15:57:47.383174-07:00[2024-04-30 22:57:47,383] INFO in controller: GET, /nodes/sync_status/                     , 200, took,    3, ms
2024-04-30 15:57:47.520240-07:00[2024-04-30 22:57:47,520] INFO in tx_fetcher: Those addresses got used recently: []
2024-04-30 15:57:48.395972-07:00[2024-04-30 22:57:48,395] INFO in controller: GET, /wallets/wallets_loading/               , 200, took,    0, ms
2024-04-30 15:57:48.454776-07:00[2024-04-30 22:57:48,454] INFO in tx_fetcher: Those addresses got used recently: []
2024-04-30 15:57:49.406814-07:00[2024-04-30 22:57:49,406] INFO in controller: GET, /wallets/wallets_loading/               , 200, took,    0, ms
2024-04-30 15:57:49.451611-07:00[2024-04-30 22:57:49,451] ERROR in wallet: list index out of range
2024-04-30 15:57:49.451640-07:00Traceback (most recent call last):
2024-04-30 15:57:49.451672-07:00File "/usr/local/lib/python3.10/site-packages/cryptoadvance/specter/wallet/wallet.py", line 721, in check_utxo
2024-04-30 15:57:49.451705-07:00searched_vout = [
2024-04-30 15:57:49.451729-07:00IndexError: list index out of range
2024-04-30 15:57:49.451835-07:00[2024-04-30 22:57:49,451] INFO in wallet_manager: Updating wallet manager done in  2182ms. Result:
2024-04-30 15:57:49.451869-07:00[2024-04-30 22:57:49,451] INFO in wallet_manager:   * loaded_wallets: 2
2024-04-30 15:57:49.451927-07:00[2024-04-30 22:57:49,451] INFO in wallet_manager:   * failed_load_wallets: 0
2024-04-30 15:57:49.452032-07:00Exception in thread Thread-286 (_update):
2024-04-30 15:57:49.452048-07:00Traceback (most recent call last):
2024-04-30 15:57:49.452082-07:00File "/usr/local/lib/python3.10/site-packages/cryptoadvance/specter/wallet/wallet.py", line 721, in check_utxo
2024-04-30 15:57:49.452313-07:00searched_vout = [
2024-04-30 15:57:49.452327-07:00IndexError: list index out of range
2024-04-30 15:57:49.452334-07:002024-04-30T15:57:49.452334696-07:00
2024-04-30 15:57:49.452341-07:00During handling of the above exception, another exception occurred:
2024-04-30 15:57:49.452359-07:002024-04-30T15:57:49.452359212-07:00
2024-04-30 15:57:49.452371-07:00Traceback (most recent call last):
2024-04-30 15:57:49.452378-07:00File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
2024-04-30 15:57:49.452644-07:00self.run()
2024-04-30 15:57:49.452664-07:00File "/usr/local/lib/python3.10/site-packages/cryptoadvance/specter/util/flask.py", line 32, in run
2024-04-30 15:57:49.452710-07:00super().run()
2024-04-30 15:57:49.452740-07:00File "/usr/local/lib/python3.10/threading.py", line 953, in run
2024-04-30 15:57:49.452989-07:00self._target(*self._args, **self._kwargs)
2024-04-30 15:57:49.453002-07:00File "/usr/local/lib/python3.10/site-packages/cryptoadvance/specter/managers/wallet_manager.py", line 243, in _update
2024-04-30 15:57:49.453113-07:00self.wallets[wallet_name].update()
2024-04-30 15:57:49.453134-07:00File "/usr/local/lib/python3.10/site-packages/cryptoadvance/specter/wallet/wallet.py", line 497, in update
2024-04-30 15:57:49.453545-07:00self.getdata()
2024-04-30 15:57:49.453568-07:00File "/usr/local/lib/python3.10/site-packages/cryptoadvance/specter/wallet/wallet.py", line 745, in getdata
2024-04-30 15:57:49.453609-07:00self.check_utxo()
2024-04-30 15:57:49.453631-07:00File "/usr/local/lib/python3.10/site-packages/cryptoadvance/specter/wallet/wallet.py", line 741, in check_utxo
2024-04-30 15:57:49.453869-07:00raise SpecterError(f"Failed to load utxos, {type(e).__name__}: {e}")
2024-04-30 15:57:49.453886-07:00cryptoadvance.specter.specter_error.SpecterError: Failed to load utxos, IndexError: list index out of range
2024-04-30 15:57:50.421684-07:00[2024-04-30 22:57:50,421] INFO in controller: GET, /wallets/wallets_loading/               , 200, took,    0, ms