You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ERROR in wallet_importer: new range must include current range = [0,1008] and new range must include current range = [0,1000]
Traceback (most recent call last):
File ".../cryptoadvance/specter/util/wallet_importer.py", line 235, in create_wallet
self.wallet = wallet_manager.create_wallet(...)
File ".../cryptoadvance/specter/managers/wallet_manager.py", line 353, in create_wallet
w = self.WalletClass.create(...)
File ".../cryptoadvance/specter/wallet/wallet.py", line 362, in create
raise SpecterError(all_issues)
SpecterError: new range must include current range = [0,1001] and new range must include current range = [0,1000]
Reported on v2.0.2 (macOS and Linux). Not verified on current v2.1.7 — please confirm if still reproducible.
Try to re-import the wallet under the same name → fails with the error above. Workaround was deleting the wallet file in Bitcoin Core and re-importing under a different name.
Root cause (best guess)
Wallet creation path at `wallet.py:353-362`:
```python
if use_descriptors:
res = wallet_rpc.importdescriptors(args)
else:
res = wallet_rpc.importmulti(args, {"rescan": False})
if not all([r["success"] for r in res]):
all_issues = " and ".join(...)
raise SpecterError(all_issues)
```
On the legacy (non-descriptor) path, args carry `"range": [0, cls.GAP_LIMIT]`. If the Bitcoin Core wallet file already contains the same descriptor at a wider range (e.g. `[0, 1008]` after `keypoolrefill` extended it), Core rejects `importmulti` with a new range of `[0, 1000]` because the new range does not include the current one. Core's rule: range can only grow on re-import, never shrink.
The error only surfaced because the earlier #2335 crash left the Core-side wallet in a state that Specter then couldn't cleanly recover from — but the shrink-refusal is an independent Specter bug.
Suggested fix directions
Query current descriptor range before re-import and pass `max(current_range_end, GAP_LIMIT)` rather than a fixed `GAP_LIMIT`.
Or: prefer the descriptor path (`importdescriptors` with `active=True`) for all Core versions that support it — the descriptor path doesn't carry the `range` constraint.
Or: on shrink-refusal, retry with the wider range extracted from the error, or explicitly re-unload/re-load the wallet file.
Split from #2335 (see @alvistar and @ironrai comments there).
Symptom
Re-creating a wallet in Specter fails with:
Reported on v2.0.2 (macOS and Linux). Not verified on current v2.1.7 — please confirm if still reproducible.
Repro (from @ironrai in #2335)
check_utxoIndexError from Error: Failed to load utxos, IndexError: list index out of range ✕ #2335 and can no longer open the wallet.Root cause (best guess)
Wallet creation path at `wallet.py:353-362`:
```python
if use_descriptors:
res = wallet_rpc.importdescriptors(args)
else:
res = wallet_rpc.importmulti(args, {"rescan": False})
if not all([r["success"] for r in res]):
all_issues = " and ".join(...)
raise SpecterError(all_issues)
```
On the legacy (non-descriptor) path, args carry `"range": [0, cls.GAP_LIMIT]`. If the Bitcoin Core wallet file already contains the same descriptor at a wider range (e.g. `[0, 1008]` after `keypoolrefill` extended it), Core rejects `importmulti` with a new range of `[0, 1000]` because the new range does not include the current one. Core's rule: range can only grow on re-import, never shrink.
The error only surfaced because the earlier #2335 crash left the Core-side wallet in a state that Specter then couldn't cleanly recover from — but the shrink-refusal is an independent Specter bug.
Suggested fix directions