Error reference

Every failure mode and what triggers it.

These are every on-chain failure mode a plan can hit. Any one of them reverts the whole transaction. The names and messages below are the exact variants of the program's PtbError enum; Anchor assigns custom error codes starting at 6000 in declaration order.

CodeErrorWhen it firesFix
6000RegisterOutOfRangeA capture (return_reg) or splice (register) names a slot >= 8. The register file has exactly 8 slots, indexed 0 to 7.Use a register index in 0 to 7. Keep no more than eight live captured values in a plan.
6001SubstitutionOverflowA splice would write its 8-byte value past the end of the step's data (offset + 8 > data length).Ensure the step's data is long enough that offset + 8 fits, counting the 8-byte discriminator prefix.
6002AccountIndexOutOfRangeA step's program_index or an account index points outside the account pool passed to execute.Reference only pubkeys you added to the plan; the PlanBuilder interns them, so pass every account a step touches.
6003NoReturnDataA step set capture but the callee returned no data via set_return_data, so there is nothing to read.Only capture from a callee that returns data. Do not set captureInto on a step whose program returns nothing.
6004AssertionOutOfRangeA gate assertion reads a range (offset + expected length) past the end of the target account's data.Point the assertion at a byte range that exists in the account's layout.
6005ObligationUnsettledThe end-of-plan gate found an obligation opened in the plan that no later step settled.Pair every open with a close on the same obligationTag, and make sure the closing step is always reachable.
PtbError variants in declaration order. Reading a program error in a log: Anchor prints the code and message, for example 'custom program error: 0x1775' is 6005, ObligationUnsettled.