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

# Errors & recovery

> Handle wallet declines, unavailable ciphertexts, quorum failures, and HTTP errors.

## Error reference

```ts theme={null}
import { CTokenError, humanizeError, isUserRejection } from "@inco/ctoken";

try {
  await ctoken.deposit({ token: USDC, amount: "1" });
} catch (error) {
  if (isUserRejection(error)) return;
  if (error instanceof CTokenError) console.log(error.code);
  console.error(humanizeError(error));
}
```

| Code                       | Meaning / recovery                                                                  |
| -------------------------- | ----------------------------------------------------------------------------------- |
| `WALLET_REQUIRED`          | Supply/connect a wallet client.                                                     |
| `NOT_CONNECTED`            | The supplied wallet has no selected account.                                        |
| `UNSUPPORTED_NETWORK`      | Use a supported NetworkName.                                                        |
| `WRONG_NETWORK`            | Wallet/public-client/source chain mismatch; switch or configure the matching chain. |
| `INVALID_CONFIG`           | Invalid URL/TTL or removed raw signer input, among other configuration failures.    |
| `INVALID_ARGUMENT`         | Invalid limits, pagination, handle shape, or option bounds.                         |
| `INVALID_ADDRESS`          | Malformed address or invalid recipient.                                             |
| `INVALID_AMOUNT`           | Unsupported amount syntax, precision, zero/negative value, or overflow.             |
| `WRAPPER_NOT_FOUND`        | No registered wrapper/configuration where a deployed wrapper is required.           |
| `READ_FAILED`              | Batched metadata/balance/scope read failed.                                         |
| `BALANCE_PENDING`          | Numeric/exact balance API cannot produce a settled plaintext yet.                   |
| `TOKENS_REQUIRED`          | Scoped reveal needs resolvable cToken scope.                                        |
| `SESSION_FAILED`           | Session creation/adoption state failed or changed during signing.                   |
| `DECRYPT_FAILED`           | Pending batch could not settle, or invalid plaintext results.                       |
| `INDEXER_NOT_CONFIGURED`   | Configure an indexer for the selected network or enable it.                         |
| `INDEXER_UNAVAILABLE`      | HTTP failure, retry exhaustion, or timeout.                                         |
| `INDEXER_INVALID_RESPONSE` | JSON/schema validation failed.                                                      |
| `TX_REVERTED`              | Confirmed receipt reverted.                                                         |
| `TX_CANCELLED`             | Original transaction was cancelled.                                                 |
| `TX_REPLACED`              | Original transaction was replaced with a different operation.                       |

`CTokenErrorCode` contains these codes. Wallet/RPC errors may propagate directly; retain their causes for diagnostics. `humanizeError(null/undefined)` returns null. Never automatically retry a declined signature.

## Confidential-network failures

`humanizeError` converts threshold/quorum and failed KMS-client errors into: **The confidential network couldn’t complete the request. Please try again shortly.**

Original errors remain available for diagnostics. Wallet declines, timeouts, and rate limits also receive concise messages.

Widgets offer explicit balance retries and keep failed balances unavailable. Persistent failures need investigation of the original cause; do not automatically resubmit transactions.
