Skip to content

fix(abstract-utxo): re-throw non-404 errors in isWalletAddress#9239

Draft
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
masterfrom
fix/cross-chain-recovery-is-wallet-address-error-handling
Draft

fix(abstract-utxo): re-throw non-404 errors in isWalletAddress#9239
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
masterfrom
fix/cross-chain-recovery-is-wallet-address-error-handling

Conversation

@bitgo-ai-agent-dev

Copy link
Copy Markdown

What

  • isWalletAddress() in crossChainRecovery.ts previously swallowed all exceptions and returned false
  • Changed the catch block to only return false for HTTP 404 (address not found in wallet); all other errors are re-thrown
  • Added unit tests covering: 200 (returns true), 404 (returns false), 503/500/401 (all re-throw)

Why

  • During cross-chain recovery, isWalletAddress() is the authorization check that determines which transaction outputs belong to the wallet
  • A transient network error or server failure (503, 500) would silently return false, excluding affected UTXOs from the recovery transaction and causing users to recover less than their full balance
  • An auth failure (401) would also silently exclude outputs rather than surfacing that something is wrong with credentials
  • Only a 404 is semantically meaningful as "this address does not belong to this wallet"

Test plan

  • isWalletAddress returns true when the API responds 200 with address data
  • isWalletAddress returns false when the API responds 404
  • isWalletAddress re-throws on 503 (server unavailable)
  • isWalletAddress re-throws on 500 (internal server error)
  • isWalletAddress re-throws on 401 (auth failure)
  • All 1545 existing @bitgo/abstract-utxo unit tests pass

Ticket: T1-3043

Previously isWalletAddress() caught all exceptions and returned false.
This caused network errors, 5xx server responses, and auth failures
during cross-chain recovery to silently exclude affected outputs,
recovering less than the full wallet balance.

Only return false for HTTP 404 (address not in wallet). Re-throw all
other errors so callers can surface transient failures rather than
silently under-recovering funds.

Ticket: T1-3043
Session-Id: 3bc07ea5-d3c9-4f2c-a632-d16bc2290847
Task-Id: fae7a7dd-6b0f-43a1-80f0-e8914b0c57b7
@bitgo-ai-agent-dev bitgo-ai-agent-dev Bot force-pushed the fix/cross-chain-recovery-is-wallet-address-error-handling branch from b8a4b7e to b4b89ab Compare July 13, 2026 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant