solidity
Solidity Panic Codes
The panic codes Solidity's compiler-generated runtime checks use to signal failures such as failed assertions, arithmetic overflow, and out-of-bounds array access. Reverted transactions surface these as a Panic(uint256) error whose argument is one of the codes below, shown here in their conventional hexadecimal form.
10 codes
· All codes 10 codes
- 0x00 Generic Panic Reserved for generic compiler-inserted panics that don't map to any of the other defined situations. Not currently emitted by solc, but reserved for future use.
- 0x01 Assertion Failed Thrown when an assert() statement evaluates to false. Signals an internal error or invariant violation that well-formed code should never trigger.
- 0x11 Arithmetic Overflow or Underflow Thrown when an arithmetic operation overflows or underflows its type's range outside of an unchecked { ... } block.
- 0x12 Division or Modulo by Zero Thrown when dividing or taking the modulo of a value by zero, e.g. 5 / 0 or 23 % 0.
- 0x21 Invalid Enum Conversion Thrown when converting a value that is too large or negative into an enum type.
- 0x22 Incorrectly Encoded Storage Byte Array Thrown when accessing a storage byte array that has been corrupted or incorrectly encoded, typically via a low-level write to its storage slot.
- 0x31 Pop on Empty Array Thrown when calling .pop() on an array that has zero elements.
- 0x32 Array Index Out of Bounds Thrown when accessing an array, bytesN, or array slice at an index that is negative or at/beyond its length, e.g. x[i] where i >= x.length.
- 0x41 Out of Memory Thrown when too much memory is allocated at once, or an array is created that is too large.
- 0x51 Uninitialized Internal Function Thrown when calling a zero-initialized variable of internal function type.