๐Ÿ”ด Error Codes

Error Codes

Complete error reference โ€” all SDK and on-chain error codes, their causes, and how to fix them.

SDK Error Codes

These are thrown as VaeaError instances in the SDK. Access via err.code.

CodeCauseFixRetried?
INSUFFICIENT_LIQUIDITYNo protocol has enough liquidityTry smaller amount or different tokenโŒ
TOKEN_NOT_SUPPORTEDToken not in VAEA registryCheck supported tokens pageโŒ
SLIPPAGE_EXCEEDEDSwap price moved beyond toleranceIncrease slippageBps or retry laterโœ…
FEE_TOO_HIGHFee exceeds your maxFeeBpsIncrease limit or skip this opportunityโŒ
REPAY_FAILEDToken repay instruction failedEnsure enough tokens to repay loan + feeโŒ
TX_EXPIREDBlockhash expired before landingSmart Retry handles this automaticallyโœ…
SOURCE_UNAVAILABLESource protocol is down or degradedWait or try different tokenโŒ
PROGRAM_PAUSEDVAEA program is paused by adminWait for unpauseโŒ
INVALID_AMOUNTAmount is zero or negativeUse a positive amountโŒ
INSUFFICIENT_SOL_FOR_FEENot enough SOL for gas + feeFund wallet with SOLโŒ
API_ERRORVAEA API returned an errorUse executeLocal() to bypass APIโŒ
NETWORK_ERRORCannot reach VAEA APICheck connectivity, use executeLocal()โŒ

On-Chain Errors (Anchor)

These errors come from the on-chain program. They appear as Custom(600X) in transaction logs.

CodeAnchor IDMessageCause
MissingEndFlash6000end_flash instruction missing from transactionbegin_flash was called but end_flash is not in the TX
MissingBeginFlash6001begin_flash instruction missing from transactionend_flash called without a matching begin_flash before it
MissingRepay6002Source protocol repay instruction not foundSource protocol repay was expected but not found
FeeMismatch6003Fee amount does not match expected fee from configexpected_fee_lamports is below the calculated minimum
Paused6004Program is pausedAdmin has paused the program via update_config
ZeroAmount6005Amount must be greater than zeroTried to borrow 0 tokens
InsufficientSolForFee6006Insufficient SOL to pay the flash loan feePayer wallet too low to cover the fee transfer
Unauthorized6007Caller is not the authorized authorityAdmin-only instruction called by non-authority
SlotExpired6008Transaction is too old (exceeded 150 slots)TX sat in mempool too long
InvalidSysvarInstructions6009Invalid Sysvar Instructions accountWrong account passed as sysvar_instructions

Error Handling

import { VaeaFlash, VaeaError } from '@vaea/flash';

try {
  const sig = await flash.executeLocal(params);
} catch (err) {
  if (err instanceof VaeaError) {
    switch (err.code) {
      case 'FEE_TOO_HIGH':
        console.log(`Fee ${err.meta?.actualFeeBps} bps > max ${err.meta?.maxFeeBps}`);
        break;
      case 'TOKEN_NOT_SUPPORTED':
        console.log('Supported:', err.meta?.supported);
        break;
      case 'INSUFFICIENT_LIQUIDITY':
        console.log('Try smaller amount');
        break;
      case 'TX_EXPIRED':
        console.log('Enable smart retry to handle this');
        break;
      default:
        console.log(`VAEA Error [${err.code}]: ${err.message}`);
    }
  } else {
    throw err;  // Not a VAEA error โ€” rethrow
  }
}
๐Ÿ’ก Tip
Enable Smart Retry to automatically handle TX_EXPIRED and SLIPPAGE_EXCEEDED errors.