Skip to content

Error codes ​

Ballista fails with a Solana custom program error, Custom(u32). The low 16 bits are the error kind, listed below, and the high 16 bits are a context number that says where the failure happened. Errors and events shows how to decode a code and name the step that failed.

text
code = kind | (context << 16)

In hex, the last four digits are the kind: 0x7177F is 0x177F (6015, RequirementFailed) at program counter 7. A program the run calls can fail with its own code, which passes through unchanged, and Anchor programs number theirs from 6000 too. Check which program failed before you read a code as Ballista's.

Context ​

For most runtime kinds, the context is the program counter: the index of the failing bytecode instruction. Four carry something else:

KindNameContext
6008InvalidRunInputsIndex of the value that could not be decoded, fixed values first. For leftover bytes, the number of values. For missing group-length bytes, 0
6010InvalidAccountRangeThe number of accounts, or of rows, that was out of range
6020AccountConstraintFailedIndex of the account, where 0 is the first account after the template account
6021CpiAccountLimitExceededThe CPI's total account count, which exceeded 64

For a verifier kind, the context is the index of the offending instruction, account, input, register, CPI or data segment, where there is one.

Runtime codes ​

Raised while uploading or running a template.

CodeHexNameMeaning
60000x1770InvalidInstructionDataThe instruction data could not be parsed
60010x1771InvalidTemplateAccountThe template account has the wrong address, owner or layout
60020x1772InvalidTemplateProgramThe template size is invalid, or the stored template does not match what the run expects
60030x1773TemplateNotUploadingWrite, finalize or cancel on a template that is already finalized
60040x1774TemplateNotFinalizedRun on a template that is still uploading
60050x1775InvalidCreatorThe signer is not the template's creator
60060x1776InvalidChunkOffsetA chunk does not start where the last one ended, or bytes are missing at finalize
60070x1777HashMismatchThe uploaded bytes do not match the hash recorded at the start
60080x1778InvalidRunInputsThe run data could not be decoded
60090x1779InvalidRuntimeAccountAn account failed a check while the template ran
60100x177AInvalidAccountRangeToo many or too few accounts or rows
60110x177BInvalidRegisterA step read a value that was never set
60120x177CTypeMismatchA value had the wrong type
60130x177DArithmeticOverflowArithmetic or a cast overflowed
60140x177EDivisionByZeroDivision by zero
60150x177FRequirementFailedA require step was false
60160x1780CpiDataTooLargeA CPI built more data than its declared maximum
60170x1781InvalidPdaDerivationA PDA could not be derived, or the bump was invalid
60180x1782MissingReturnDataThe CPI returned no data, or too little for the read
60190x1783ReturnDataMismatchThe return data came from a different program
60200x1784AccountConstraintFailedAn account does not match its declaration
60210x1785CpiAccountLimitExceededA CPI's accounts plus its account group exceed 64
60220x1786LoopCountExceededA repeat count was above the loop's max
60230x1787InstructionOutOfRangeA read asked for an instruction, account position or byte range that does not exist
60240x1788WritableAccountBytesReadaccountDataBytes read an account the transaction passed as writable
60250x1789InvalidRegistryEntryAn account passed as a registry entry is not that entry (wrong address, owner, size or header), or is an entry this run already has open (two entries of one registry with equal keys)
60260x178ARegistryReentryA CPI passed an open registry entry as writable

A declared signer that did not sign fails with Solana's MissingRequiredSignature, not a Ballista code. A registry entry passed read-only fails before the first step with AccountConstraintFailed (6020) and the entry's account index.

Verifier codes ​

Raised by CreateTemplate or FinalizeTemplate when the template fails its checks.

CodeHexNameMeaning
61000x17D4TruncatedThe template is shorter than its header says
61010x17D5PayloadTooLargeThe template is over 10,240 bytes
61020x17D6InvalidMagicThe template does not start with BVM1
61030x17D7UnsupportedVersionUnknown bytecode version
61040x17D8InvalidReservedBytesA reserved byte or flag is set
61050x17D9SectionLengthMismatchThe sections do not add up to the template's length
61060x17DACountOverflowA section count overflows
61070x17DBTooManyAccountsToo many accounts at the maximum rows
61080x17DCTooManyInputsToo many inputs or input values
61090x17DDTooManyRegistersMore than 64 registers
61100x17DETooManyInstructionsNo instructions, or more than 128
61110x17DFInvalidBatchThe batch or a forEach is malformed, or a batch has no forEach
61120x17E0InvalidAccountConstraintAn account declaration is invalid
61130x17E1InvalidInputAn input declaration is invalid
61140x17E2InvalidInstructionAn instruction is invalid, or sets a field its opcode doesn't use
61150x17E3InvalidCpiA CPI is invalid, is never invoked, or asks for more privilege than the account allows
61160x17E4InvalidDataSegmentA data part or PDA seed is invalid, or nothing uses it
61170x17E5InvalidRegisterA register index is out of range
61180x17E6RegisterNotInitializedA register is read before it is set
61190x17E7TypeMismatchAn instruction receives the wrong type
61200x17E8InvalidBlobRangeA u128 or bytes constant points outside the stored bytes, or has the wrong length
61210x17E9ExcessiveCpiExpansionMore than 64 CPIs in the worst case, with every loop run to its maximum
61220x17EAInvalidFlagsAn instruction sets flags its opcode does not accept
61230x17EBInvalidCarryA carried value is unset before the loop or changes type in it
61240x17ECReadOutOfBoundsA fixed-offset read runs past the account's minimum length
61250x17EDTooManyCpiAccountsA CPI lists more than 64 accounts
61260x17EEInvalidReturnDataA return-data read is not directly after an unguarded invoke
61270x17EFInvalidMinIterationsThe minimum rows exceed the maximum, or are set without a batch
61280x17F0TooManyAccountGroupsMore than 8 account groups
61290x17F1InvalidLoopMore than 8 loops, a repeat inside another loop or naming a row, or a malformed repeat
61300x17F2InvalidOutputAn emit or setReturnData breaks a rule in Output
61310x17F3InvalidIntrospectionA read of the transaction's instructions names an account not pinned to the Instructions sysvar
61320x17F4InvalidRegistryA registry entry is opened in a loop or after a CPI, passed writable to a CPI, read as raw data, or otherwise breaks a rule in Registries
61330x17F5InvalidAccountGroupA group expression names an undeclared group, or its filter breaks a rule in Account groups

The same names, in code order, are in fixtures/runtime-error-names.txt and fixtures/verifier-error-names.txt, which the program and both SDKs are tested against. The TypeScript SDK exports them as RUNTIME_ERROR_NAMES and VERIFIER_ERROR_NAMES.

BALLISTA / A SMALL MACHINE FOR COMPLEX TRANSACTIONS