Skip to main content

General Errors (0–19)

This category contains foundational protocol errors that are not tied to a specific subsystem.

These errors typically relate to:

  • Instruction decoding
  • Account validation
  • Arithmetic safety
  • PDA verification
  • Serialization/deserialization

These should be treated as critical validation failures.


Error Reference Table

CodeNameMessageCauseSolution
0InvalidInstructionInvalid instructionInstruction discriminator not recognizedCheck instruction data encoding
1InvalidAccountInvalid accountAccount does not match expected type or stateVerify account PDA derivation and initialization
2InsufficientFundsInsufficient fundsUser account lacks sufficient balanceDeposit more collateral before trading
3MathOverflowArithmetic overflowCalculation result exceeds maximum valueReduce trade size or check input values
4MathUnderflowArithmetic underflowCalculation result below minimum valueCheck calculation inputs for negative results
5DivisionByZeroDivision by zeroAttempted division by zeroReport to developers — indicates logic bug
6InvalidPDAInvalid PDAPDA does not match expected derivationVerify PDA seeds and program ID
7AccountNotOwnedByProgramAccount not owned by programAccount owner does not match program IDEnsure account was created by correct program
8InvalidAccountDataInvalid account dataAccount data cannot be deserializedAccount may be corrupted or wrong type
9AccountAlreadyInitializedAccount already initializedAttempted double initializationUse existing account or new PDA seeds
10InsufficientBalanceInsufficient balanceAvailable balance too low for operationClose positions or deposit more funds
13InvalidArgumentInvalid argumentInstruction parameter invalidValidate parameter values and types
14InstructionPackErrorError packing instruction dataFailed to serialize instructionCheck Borsh encoding
15InstructionUnpackErrorError unpacking instruction dataFailed to deserialize instructionVerify instruction format

Category Characteristics

General errors typically originate from:

  • require!() validations
  • Borsh unpack failures
  • PDA seed mismatches
  • Safe math wrappers
  • Account owner checks
  • Initialization guards

These errors should never be ignored.