> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arksat.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Errors

> Handle wallet rejection, context changes, and service errors.

Errors from the Provider expose `code`, `message`, `retryable`, and optional `retryAfter` in seconds. Check code rather than relying on instanceof across scripts. Local utilities and cancellation may throw ordinary errors.

| Code | Handling |
| - | - |
| USER\_REJECTED | Preserve input and wait for another user action |
| UNAUTHORIZED | Request the required connection permissions |
| WALLET\_LOCKED | Ask the user to unlock |
| CONTEXT\_CHANGED | Discard the old session and reload |
| UNSUPPORTED\_METHOD | Check capabilities |
| INVALID\_PARAMS | Correct inputs |
| INSUFFICIENT\_FUNDS | Check available BTC and tokens |
| QUOTE\_EXPIRED | Refresh the quote |
| RATE\_LIMITED | Wait according to retryAfter and reduce concurrency |
| TIMEOUT | Check transaction state before retrying |
| NETWORK\_ERROR | Show the error and allow reads to refresh |
| EXTENSION\_DISCONNECTED | Check the extension and reconnect |
| INTERNAL\_ERROR | Report non-sensitive diagnostics |

```ts theme={null}
export function walletErrorMessage(error: unknown): string {
  if (typeof error === 'object' && error !== null && 'code' in error) {
    if (error.code === 'USER_REJECTED') return 'Request cancelled'
    if (error.code === 'CONTEXT_CHANGED') return 'Wallet changed. Reconnect.'
  }
  return error instanceof Error ? error.message : 'Wallet request failed'
}
```

## Retry policy

Only retry reads explicitly marked retryable, using bounded backoff. The SDK does not remove upstream HTTP 429 limits.

Do not automatically retry payments, asset mutations, or signatures. A timeout may occur after submission.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.