Skip to main content

Errors

The Owney SDK throws OwneyError instances for SDK-level failures. Convenience subclasses are provided for common cases, but all public SDK errors share the same code, optional details, and optional agentId fields.

OwneyError​

class OwneyError extends Error {
readonly code: OwneyErrorCode;
readonly details?: Record<string, unknown>;
readonly agentId?: string;
}

When agentId is set, error.message is prefixed with both the error code and the agent, for example [AGENT_NOT_FOUND][agent:zyfai] ....

Convenience subclasses​

ClassCodeNotes
AgentNotFoundErrorAGENT_NOT_FOUNDMessage: Unknown agent "<agentId>". Available agents: <agents>
NotConnectedErrorNOT_CONNECTEDMessage: "Not connected. Call sdk.connect(provider) first."
AgentChainIncompatibleErrorAGENT_CHAIN_INCOMPATIBLEExtra properties: incompatibleAgents, connectedChainId

Error codes​

type OwneyErrorCode =
| "NOT_CONNECTED"
| "NO_ACTIVE_CHAIN"
| "WALLET_NO_ACCOUNTS"
| "WALLET_ADDRESS_REQUIRED"
| "AGENT_NOT_FOUND"
| "AGENT_CHAIN_INCOMPATIBLE"
| "AGENT_EMPTY_LIST"
| "AGENT_DISABLED"
| "CHAIN_UNSUPPORTED"
| "CHAIN_NO_COMPATIBLE_AGENTS"
| "ASSET_UNSUPPORTED"
| "ASSET_NO_COMPATIBLE_AGENTS"
| "DEPOSIT_AMOUNT_BELOW_MINIMUM"
| "DEPOSIT_CALLBACK_REQUIRED"
| "DEPOSIT_CALLBACK_INVALID"
| "DEPOSIT_NO_PERMITTED_TOKENS"
| "WITHDRAW_NO_PERMITTED_TOKENS"
| "WITHDRAW_INSUFFICIENT_BALANCE"
| "WITHDRAW_ALL_FAILED"
| "WITHDRAW_PARTIAL_FAILURE"
| "WITHDRAW_SWAP_INCOMPLETE"
| "WITHDRAW_FAILED"
| "API_ROUTING_ERROR"
| "API_ROUTING_FAILED"
| "API_NO_AGENTS"
| "SPONSOR_REQUEST_FAILED"
| "PERMIT2_APPROVAL_REQUIRED"
| "SWAP_DISABLED"
| "SWAP_RATE_LIMITED"
| "SWAP_REQUEST_FAILED"
| "SWAP_QUOTE_FAILED"
| "SWAP_UNSUPPORTED_PAIR"
| "SWAP_APPROVAL_REQUIRED"
| "SWAP_BELOW_DEPOSIT_MINIMUM"
| "SWAP_DEPOSIT_PENDING"
| "SWAP_WALLET_PROMPT_TIMEOUT"
| "SWAP_INSUFFICIENT_GAS"
| "SWAP_NATIVE_UNSUPPORTED"
| "SWAP_ORDER_EXPIRED"
| "SWAP_ORDER_REFUNDED"
| "SWAP_ORDER_CANCELLED"
| "SWAP_ORDER_NOT_FOUND"
| "WITHDRAW_ARRIVAL_TIMEOUT"
| "WITHDRAW_SWAP_FAILED"
| "BALANCE_ALL_FAILED"
| "ALLOCATION_ALL_FAILED"
| "POOL_CATALOG_UNSUPPORTED"
| "POOL_SELECTION_UNSUPPORTED"
| "POOL_SELECTION_NOT_APPLIED"
| "POOL_SELECTION_RULE_LIMIT"
| "VALIDATION_INVALID_DAYS";

Swap errors​

CodeMeaningNext step
SWAP_DISABLEDSwapping is unavailable.Keep the original asset and try again later.
SWAP_RATE_LIMITEDToo many swap requests were made.Retry after a delay.
SWAP_REQUEST_FAILEDThe swap request could not be completed.Check details.outcome before retrying.
SWAP_QUOTE_FAILEDA quote could not be created.Change the amount or pair and request another quote.
SWAP_UNSUPPORTED_PAIRThe selected assets or chains cannot be swapped.Choose another pair.
SWAP_APPROVAL_REQUIREDThe source token still needs approval.Complete the approval and retry.
SWAP_BELOW_DEPOSIT_MINIMUMThe minimum quoted output is below the agent minimum.Increase the source amount.
SWAP_DEPOSIT_PENDINGThe swap completed, but the deposit did not. The target asset is in the wallet.Call completePendingDeposit; do not swap again.
SWAP_WALLET_PROMPT_TIMEOUTThe wallet did not answer the prompt and nothing was submitted.Retry the operation.
SWAP_INSUFFICIENT_GASThe wallet cannot pay the required transaction gas.Add the chain's native asset, then retry.
SWAP_NATIVE_UNSUPPORTEDThe selected native source asset cannot be prepared for this route.Choose another source asset.
SWAP_ORDER_EXPIREDThe submitted order expired.Follow the reported order state while funds settle or return.
SWAP_ORDER_REFUNDEDThe submitted order was refunded.Confirm the returned source balance.
SWAP_ORDER_CANCELLEDThe submitted order was cancelled.Follow the reported order state while funds return.
SWAP_ORDER_NOT_FOUNDThe swap was not accepted.Request a new quote and retry.
WITHDRAW_SWAP_INCOMPLETEThe withdrawal could not safely continue into a swap.Recheck or continue the saved withdrawal; do not withdraw again.
WITHDRAW_ARRIVAL_TIMEOUTThe withdrawal did not arrive before the wait ended.Check the original asset balance and withdrawal status.
WITHDRAW_SWAP_FAILEDThe withdrawal completed, but the swap did not.The original asset remains in the wallet; do not repeat the withdrawal.

See Swapping for the recovery flow.

Pool customization errors​

CodeMeaning
POOL_CATALOG_UNSUPPORTEDThe selected agent does not provide a pool catalogue.
POOL_SELECTION_UNSUPPORTEDThe selected agent cannot read or save pool selections.
POOL_SELECTION_NOT_APPLIEDThe saved selection could not be verified. Do not start the deposit.
POOL_SELECTION_RULE_LIMITThe selection cannot be stored because its rule limit has been reached.

See Pool customization for the related methods.

Code reference​

CodeMeaning
NOT_CONNECTEDWallet-dependent method called before connect().
NO_ACTIVE_CHAINMethod called before activateAgent().
WALLET_NO_ACCOUNTSProvider returned no accounts during connect().
WALLET_ADDRESS_REQUIREDWallet address was missing during agent auth.
AGENT_NOT_FOUNDUnknown agent ID was passed.
AGENT_CHAIN_INCOMPATIBLEOne or more selected agents do not support the requested chain.
AGENT_EMPTY_LISTAn empty agentId array was passed to activateAgent().
AGENT_DISABLEDA disabled agent was explicitly selected for activation or deposit.
CHAIN_UNSUPPORTEDChain ID is not in the supported list.
CHAIN_NO_COMPATIBLE_AGENTSNo agents support the requested chain.
ASSET_UNSUPPORTEDThe selected agent does not support the asset on the active chain.
ASSET_NO_COMPATIBLE_AGENTSNo agents support the asset on the active chain.
DEPOSIT_AMOUNT_BELOW_MINIMUMDeposit amount is below an agent minimum.
DEPOSIT_CALLBACK_REQUIREDA callback was required by an underlying deposit path but was not provided.
DEPOSIT_CALLBACK_INVALIDdepositCallback did not return a tx hash.
DEPOSIT_NO_PERMITTED_TOKENSNo permitted deposit tokens were available.
WITHDRAW_NO_PERMITTED_TOKENSNo permitted withdrawal tokens were available.
WITHDRAW_INSUFFICIENT_BALANCERequested withdrawal exceeds total available balance.
WITHDRAW_ALL_FAILEDAll eligible agent withdrawals failed.
WITHDRAW_PARTIAL_FAILURESome withdrawals succeeded, but the full requested amount could not be completed.
WITHDRAW_FAILEDAn underlying agent withdrawal attempt failed.
API_ROUTING_ERRORRouting API returned a non-OK HTTP status.
API_ROUTING_FAILEDRouting API returned success: false.
API_NO_AGENTSThe routing API returned no supported agents.
SPONSOR_REQUEST_FAILEDSponsored deposit request failed (network error or non-success sponsor API response).
PERMIT2_APPROVAL_REQUIREDA gasless WETH deposit needs a one-time Permit2 approval. Call approvePermit2 (the SDK also attempts this automatically).
BALANCE_ALL_FAILEDAll active-agent balance requests failed.
ALLOCATION_ALL_FAILEDAll active-agent allocation inputs failed.
POOL_CATALOG_UNSUPPORTEDThe selected agent does not provide a pool catalogue.
POOL_SELECTION_UNSUPPORTEDThe selected agent cannot read or save pool selections.
POOL_SELECTION_NOT_APPLIEDThe saved pool selection could not be verified.
POOL_SELECTION_RULE_LIMITThe pool selection cannot be stored because its rule limit has been reached.
VALIDATION_INVALID_DAYSAn invalid APY lookback value was provided.