Skip to main content

SDK error surfaces

@cloak.dev/sdk exposes two main layers:
  1. CloakError (runtime SDK operations)
  2. parseError / parseTransactionError (user-facing normalization)

CloakError

Most app flows should treat retryable === true as backoff-eligible.

Stale Merkle root (0x1001)

Use helpers for RootNotFound detection:
SDK note and UTXO flows already include retry loops; this usually appears only after retries are exhausted.

On-chain error message mapping

ShieldPoolErrors maps known custom program codes:

User-facing normalization

Practical retry strategy

  • Retry network and service failures with exponential backoff.
  • Avoid retrying deterministic validation failures.
  • On stale-root errors, rebuild proof data before retrying.

UTXO stale-root retry template

Security logging rule

Never log full notes/UTXOs with secrets. Log only non-sensitive identifiers (commitment prefix, leaf index, request ID, and tx signature when needed for support).