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

# SDK Errors

> Handle SDK validation failures, simulation reverts, submission failures, and receipts.

`KuruSdkError` contains a stable `code` and optional `cause`. Current codes cover missing or invalid addresses, hex and byte lengths, signatures, integer widths, missing wallet clients, signer and nonce resolution, unsupported signers, wallet-intent validation, and contract-error decoding.

```typescript theme={null}
import { decodeKuruContractError, KuruSdkError } from "@toxicflow-labs/ts-sdk";

try {
  await kuru.spot.batch(params);
} catch (error) {
  if (error instanceof KuruSdkError) console.error(error.code, error.message);
  throw error;
}
```

Use `decodeKuruContractError(revertData)` for Kuru custom errors. Preserve the original viem error and transaction inputs in logs; decoded names alone may omit the failing call context.

Separate four states in application logic:

1. local input validation failed;
2. simulation reverted;
3. submission failed or was replaced;
4. transaction was included and either succeeded or reverted.

Do not retry writes blindly. Re-read nonce, slot order ID, balance, allowance, deadline, and receipt state before rebuilding an action.


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