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

# Errors

> Error codes the SDK throws and how to handle them.

The SDK uses standard EIP-1193 and JSON-RPC error codes. All errors are instances of `ProviderRpcError` with a `code`, `message`, and optional `data` field.

## Provider errors

| Code | Name | Meaning |
| - | - | - |
| `4001` | User rejected | User dismissed the popup or rejected the request |
| `4100` | Unauthorized | Method requires a connected account; call `eth_requestAccounts` first |
| `4200` | Unsupported method | The method is not supported by the SDK or in the current context |
| `4900` | Provider disconnected | The popup is unreachable |
| `4901` | Chain disconnected | The active chain is not reachable |
| `4902` | Unsupported chain | Chain not in `appChainIds` |

## RPC errors

| Code | Name | Meaning |
| - | - | - |
| `-32700` | Parse error | Malformed JSON in request |
| `-32600` | Invalid request | Request shape invalid |
| `-32601` | Method not found | Unknown method name |
| `-32602` | Invalid params | Parameters don't match the method's schema |
| `-32603` | Internal error | Unexpected internal failure |

## Handling rejections

```ts theme={null}
try {
  const hash = await sendTransactionAsync({ to, value })
} catch (error) {
  if (error.code === 4001) {
    // User cancelled
    return
  }
  if (error.code === 4100) {
    // Not connected, prompt connect
    return
  }
  throw error
}
```

## Wagmi errors

Wagmi wraps provider errors in its own error types. The same `code` values are preserved on the `cause` field:

```ts theme={null}
try {
  await sendTransactionAsync({ to, value })
} catch (error) {
  if (error.cause?.code === 4001) {
    // User cancelled
  }
}
```

## Popup-specific failures

| Symptom | Likely cause |
| - | - |
| Popup never opens | Browser popup blocker; the call must be triggered from a user gesture |
| Popup opens then immediately closes | Cross-Origin-Opener-Policy mismatch on the host page |
| Connection completes but `accountsChanged` never fires | Listener registered after connection; subscribe before calling `connect` |


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