跳到主要内容

TVM Exit codes

If TVM exits with an arbitrary 16-bit unsigned integer exit_code. exit_code higher than 1, it is considered an error code. Therefore, an exit with such a code may cause the transaction to revert or bounce.

Standard exit codes

信息

The list of standard exit codes contains all universal TVM exit codes defined for the TON Blockchain. Alternative exit codes should be sought in the source code of the corresponding contract.

Exit CodeTVM PhaseDescription
0Compute PhaseStandard successful execution exit code.
1Compute PhaseAlternative successful execution exit code.
2Compute PhaseStack underflow. The last op-code consumed more elements than there are on the stacks. 1
3Compute PhaseStack overflow. More values have been stored on a stack than are allowed by this version of TVM.
4Compute PhaseInteger overflow. Integer does not fit into −2256 ≤ x < 2256 or a division by zero has occurred.
5Compute PhaseInteger is out of expected range.
6Compute PhaseInvalid opcode. The instruction is unknown in the current TVM version.
7Compute PhaseType check error. An argument to a primitive has an incorrect value type. 1
8Compute PhaseCell overflow. Writing to the builder is not possible since after operation there would be more than 1023 bits or 4 references.
9Compute PhaseCell underflow. The read operation from slice primitive tried to read more bits or references than available.
10Compute PhaseDictionary error. An error during manipulation with the dictionary (hashmaps).
11Compute PhaseMost often caused by trying to call get-method whose id wasn't found in the code (missing method_id modifier or wrong get-method name specified when trying to call it). In TVM docs its described as "Unknown error, may be thrown by user programs".
12Compute PhaseThrown by TVM in situations considered impossible.
13Compute PhaseOut of gas error. Thrown by TVM when the remaining gas turns negative.
-14Compute PhaseThis indicates an out of gas error, the same as code 13. It is negative because it cannot be faked
32Action PhaseAction list is invalid. Set during the action phase if c5 register after execution contains unparsable object.
-32Action Phase(the same as prev 32) - Method ID not found. Returned by TonLib during an attempt to execute non-existent get method.
33Action PhaseThe action list is too long.
34Action PhaseAction is invalid or not supported. Set during the action phase if current action cannot be applied.
35Action PhaseInvalid Source address in the outbound message.
36Action PhaseInvalid Destination address in the outbound message.
37Action PhaseNot enough TON. The message sends too much TON, or there isn't enough TON remaining after deducting fees.
38Action PhaseNot enough extra-currencies.
40Action PhaseNot enough funds to process the message. This error is thrown when there is only enough gas to partially cover the message, but not enough to cover it completely.
43Action PhaseThe maximum number of cells in the library has been exceeded, or the maximum depth of the Merkle tree has been surpassed.

1 If you encounter such exception in a func contract it probably means a type error in asm declarations.

信息

Often you can see the exit code 0xffff (65535 in decimal form). This usually means that the received opcode is unknown to the contract. When writing contracts, this code is set by the developer himself.