PAR docs

Error reference

Every error the program can return, from errors.rs, with the usual cause and what to do. Anchor numbers custom errors from 6000 in declaration order.

CodeNameMessageUsual causeWhat to do
6000MathOverflowArithmetic overflow or an accounting total would go negativeAn amount far beyond any real balanceUse realistic amounts
6001ProgramUpgradeableThe program must be immutable (no upgrade authority) before the protocol startsinitialize sent while an upgrade authority existsMake the program immutable first
6002CollateralNotListedThis collateral mint is not listedcreate_branch with a mint other than jitoSOL or mSOLOnly listed collateral has a branch
6003WrongRateSourceRate source account does not match the listed one for this collateralWrong stake pool or Marinade state passedPass the listed rate source
6004InvalidRateSourceRate source account data could not be readCorrupted or wrong accountPass the listed rate source
6005InvalidOracleAccountOracle account has the wrong owner or layoutWrong Pyth or Switchboard accountUse the feed accounts from Integration
6006OracleStalePyth or Switchboard price is missing or stale: new borrowing is pausedA feed older than 120 s, or a wide Pyth confidenceRetry once the feed updates; redemptions still work
6007OracleDisagreementPyth and Switchboard disagree beyond the allowed deviation: new borrowing is pausedFeeds more than 2% apartRetry later; redemptions still work
6008OracleUnavailableNo fresh oracle price is availableBoth feeds staleWait for a feed update
6009InvalidBucketRate bucket index out of rangeIndex 246 or aboveUse 0 to 245
6010ZeroAmountAmount must be greater than zeroZero passedPass a positive amount
6011DebtBelowMinimumTrove debt would fall below the minimumDebt under 200 PARBorrow at least 200 PAR
6012BelowMinimumCollateralRatioCollateral ratio would fall below 120%Too much debt or too little collateralAdd collateral or borrow less
6013DebtCeilingExceededBranch debt would exceed the scheduled debt ceilingThe branch is at its current ceilingWait for the next doubling or use the other branch
6014WrongBranchAccount belongs to a different branchA trove, bucket or deposit from another collateralDerive accounts from the same branch
6015TroveNotActiveTrove is not activeAdjusting a redeemed-out or liquidated troveUse close_trove to collect what is left
6016RepayTooLargeRepayment exceeds what can be repaid without closing the troveRepay would drop debt under 200 PARUse close_trove to repay everything
6017InsufficientCollateralNot enough collateral in the troveWithdrawing more than the trove holdsWithdraw less
6018SameRateNew rate equals the current rateset_rate to the current bucketPick a different bucket
6019TroveHealthyTrove collateral ratio is not below 120%Liquidating a safe troveNothing to do
6020NothingToAbsorbNothing can absorb this liquidation: the stability pool is short and no other trove existsLast trove of a branch with an empty poolFill the pool first
6021WrongRedemptionOrderRedemption must start from the lowest-rate non-empty bucketA stale bucket listRebuild the list from the bitmap
6022TroveNotInBucketTrove does not belong to the bucket listed before itTrove moved bucketsRebuild the list
6023InvalidRedemptionAccountRedemption account is neither a bucket nor a trove of this branchForeign account in the listPass only buckets and troves
6024RedemptionFeeTooHighRedemption fee exceeds the caller's maximumBase rate rose after a burst of redemptionsRaise max_fee_bps or wait for it to decay
6025InsufficientParPAR balance does not cover the requested redemptionAsking for more than you holdRedeem less
6026NothingRedeemedNothing was redeemedEvery listed trove was skippedRebuild the list
6027InvalidParAccountToken account does not hold PAR for this ownerWrong token accountPass the owner's PAR account
6028DepositNotEmptyDeposit still holds PARclose_deposit on a live depositWithdraw everything first

Decoding an error

ts
import { AnchorError } from "@coral-xyz/anchor"

try {
  await program.methods.borrow(new BN(1_000_000)).accounts(accounts).rpc()
} catch (e) {
  if (e instanceof AnchorError) {
    console.log(e.error.errorCode.code, e.error.errorMessage) // "OracleDisagreement", "Pyth and Switchboard disagree ..."
  }
}