Skip to content
CTRL K
    Errors

    Errors

    When a call cannot complete, the SDK throws NutrimaticError with a stable string code. Use code in your UI and logging to decide what to show the user (toast, disable a button, retry, or fix config) — do not parse message for branching; messages may change.

    import { NutrimaticError } from '@nutrimatic/sdk'
    
    try {
      await sdk.easy.read.getChart({ pair: '42-USDT', interval: '1h' })
    } catch (error) {
      if (error instanceof NutrimaticError) {
        // Branch on error.code — e.g. show "try again" vs "this action is unavailable"
        console.error(error.code, error.message)
      }
    }

    Example — error shape

    What you inspect after instanceof NutrimaticError:

    {
      "name": "NutrimaticError",
      "code": "CAPABILITY_NOT_AVAILABLE",
      "message": "staking.stake is not available."
    }
    FieldWhat to use it for
    codeStable switch in UI / analytics (this is the contract).
    messageHuman-readable detail for logs or optional secondary copy.
    nameAlways NutrimaticError for instanceof checks.

    Common codes

    CodeMeaning
    INTEGRATION_CONTEXT_REQUIREDConfig is missing integrationContext ('client' or 'backend'). Set it when calling createNutrimaticSdk.
    INVALID_CONFIGConfig failed validation at init (e.g. duplicate ledger id / alias, empty ledgers). Fix config and recreate the SDK.
    INFRASTRUCTURE_UNAVAILABLENutrimatic could not reach its service, or the operation could not complete. Retry later or check connectivity.
    READ_ONLY_MODEA write was called but the SDK was created with mode: 'read'. Use 'full' when your app runs writes — Modes.
    CAPABILITY_NOT_AVAILABLEThe operation is not available for this config or request. Do not retry like a network timeout.
    LEDGER_NOT_SUPPORTEDThe ledger is not in your config, or the LedgerScope string did not match any configured id or alias.
    VENUE_NOT_FOUNDThe venue ID you passed does not match any known pool.
    PAIR_NOT_FOUNDThe pair label you passed does not resolve to a known market.
    INSTRUMENT_NOT_FOUNDThe instrument ID (or symbol) you passed does not resolve.
    MANIFEST_NOT_FOUNDNo deployment manifest is available for this ledger.
    NORMALIZATION_FAILEDNutrimatic could not normalize the underlying data into a display-ready shape.
    WALLET_REQUIREDA wallet was needed (signing, or omitted owner on a portfolio read) and none was configured — Whose wallet (owner).

    Do not branch on MODULE_NOT_IMPLEMENTED — it is unused.

    When to use which code

    These codes are easy to confuse. Branch on them like this:

    You see…What it meansWhat to do
    READ_ONLY_MODEYou called a write after init with mode: 'read'Recreate with 'full' and a wallet — Modes
    WALLET_REQUIREDSigning or default owner needs a WalletAdapterPass wallet, or pass owner explicitly on reads
    LEDGER_NOT_SUPPORTEDLedger / scope is missing or does not resolve in your configFix ledgers or the LedgerScope you passed
    PAIR_NOT_FOUND / INSTRUMENT_NOT_FOUND / VENUE_NOT_FOUNDLookup key does not resolveFix the pair label, instrument id, or venue id
    INFRASTRUCTURE_UNAVAILABLEService unreachable, or a read path could not completeRetry / check connectivity — may be transient
    CAPABILITY_NOT_AVAILABLEThis action is not available for this config or requestDisable or hide the action; do not retry as if it were infra

    Write codes

    CodeMeaning
    USER_REJECTEDThe user (or adapter) declined to sign.
    QUOTE_EXPIREDThe quote’s expiresAt passed, or the sign request expired before execution.
    SLIPPAGE_EXCEEDEDThe market moved beyond the allowed slippageBps (bps) before the trade could settle.
    INSUFFICIENT_ALLOWANCEYour wallet’s approved spend allowance is too low to cover this operation.

    Write overview: Write operations.