Skip to main content
This document contains VM-specific error codes, fault types, and syscall errors that can occur during program execution in the Thru virtual machine.

VM Error Codes

These errors occur at the virtual machine level during program execution:
TN_VM_SUCCESS
0x00000000 (0)
Virtual machine execution completed successfully.
TN_VM_ERR_SIGTEXT
0xFFFFFFFFFFFFFFFF (-1)
Invalid or corrupted program text/code segment. This indicates the executable format is malformed or the program code cannot be loaded properly.
TN_VM_ERR_SIGILL
0xFFFFFFFFFFFFFFFE (-2)
Illegal instruction encountered during execution. The program attempted to execute an invalid or unsupported instruction. See Instruction Set for supported operations.
TN_VM_ERR_SIGSEGV
0xFFFFFFFFFFFFFFFD (-3)
Segmentation fault - invalid memory access. The program attempted to access memory outside its allocated segments or violated memory protection rules. See Memory Layout for segment boundaries.
TN_VM_ERR_SIGFAULT
0xFFFFFFFFFFFFFFFC (-4)
General memory fault. A memory operation failed due to invalid addressing or protection violations.
TN_VM_ERR_SIGCU
0xFFFFFFFFFFFFFFFB (-5)
Compute units (CU) exhausted during execution. The program exceeded its allocated computational resources. See Compute Units for resource limits.
TN_VM_ERR_SIGSU
0xFFFFFFFFFFFFFFFA (-6)
Storage units (SU) exhausted during execution. The program exceeded its allocated memory/storage resources. See Memory Units for resource limits.

VM Fault Types

TN_VM_FAULT_REVERT
0x01
Program execution was explicitly reverted. The program called the exit syscall with a revert instruction.
TN_VM_FAULT_SIGCU
0x02
Compute unit exhaustion fault. Execution halted due to CU limit being reached.
TN_VM_FAULT_SIGSU
0x03
Storage unit exhaustion fault. Execution halted due to SU limit being reached.

Syscall Errors

These errors can occur during syscall execution and are returned by system calls to indicate specific failure conditions:

Success Codes

TN_VM_SYSCALL_SUCCESS
0x00000000 (0)
Syscall completed successfully.
TN_VM_SYSCALL_SUCCESS_EXIT
0x00000001 (1)
Syscall completed successfully and program should exit normally.

Account and Segment Errors

TN_VM_ERR_SYSCALL_BAD_SEGMENT_TABLE_SIZE
0xFFFFFFFFFFFFFFF9 (-7)
The segment table size is invalid or corrupted. This may occur when memory layout is incorrectly configured.
TN_VM_ERR_SYSCALL_INVALID_ACCOUNT_INDEX
0xFFFFFFFFFFFFFFF8 (-8)
The provided account index is out of bounds or invalid. Account indices must be within the transaction’s account list range.
TN_VM_ERR_SYSCALL_ACCOUNT_DOES_NOT_EXIST
0xFFFFFFFFFFFFFFF7 (-9)
The referenced account does not exist in the ledger state. See account_create syscall to create new accounts.
TN_VM_ERR_SYSCALL_ACCOUNT_NOT_WRITABLE
0xFFFFFFFFFFFFFFF6 (-10)
Attempted to modify an account that is not marked as writable in the transaction. The account must be included in the read-write account list. See set_account_data_writable syscall.
TN_VM_ERR_SYSCALL_ACCOUNT_ALREADY_EXISTS
0xFFFFFFFFFFFFFFF1 (-15)
Attempted to create an account that already exists. Use account_create syscall only for new accounts.
TN_VM_ERR_SYSCALL_BAD_ACCOUNT_ADDRESS
0xFFFFFFFFFFFFFFF0 (-16)
The provided account address is malformed or invalid format.
TN_VM_ERR_SYSCALL_ACCOUNT_IS_NOT_PROGRAM
0xFFFFFFFFFFFFFFEF (-17)
Attempted a program-specific operation on an account that is not executable/program account.
TN_VM_ERR_SYSCALL_ACCOUNT_HAS_DATA
0xFFFFFFFFFFFFFFEE (-18)
Attempted to perform an operation that requires an empty account, but the account contains data. See account_delete syscall to clear account data.
TN_VM_ERR_SYSCALL_INVALID_ACCOUNT
0xFFFFFFFFFFFFFFE5 (-27)
The account reference or structure is invalid or corrupted.
TN_VM_ERR_SYSCALL_INVALID_ACCOUNT_DATA_SIZE
0xFFFFFFFFFFFFFFDD (-35)
The specified account data size is invalid or exceeds limits. See account_resize syscall for resizing constraints.

Balance and Transfer Errors

TN_VM_ERR_SYSCALL_BALANCE_OVERFLOW
0xFFFFFFFFFFFFFFF5 (-11)
A balance operation would result in integer overflow. This prevents balance corruption.
TN_VM_ERR_SYSCALL_INSUFFICIENT_BALANCE
0xFFFFFFFFFFFFFFDA (-38)
Insufficient account balance for the requested transfer operation. See account_transfer syscall.

Memory and Segment Errors

TN_VM_ERR_SYSCALL_ACCOUNT_TOO_BIG
0xFFFFFFFFFFFFFFF4 (-12)
The account size exceeds maximum allowed limits for account data.
TN_VM_ERR_SYSCALL_SEGMENT_ALREADY_MAPPED
0xFFFFFFFFFFFFFFED (-19)
Attempted to map a memory segment that is already mapped or in use.
TN_VM_ERR_SYSCALL_INVALID_SEGMENT_ID
0xFFFFFFFFFFFFFFEB (-21)
The provided segment ID is invalid or out of range. See Memory Layout for valid segment types.
TN_VM_ERR_SYSCALL_INVALID_SEGMENT_SIZE
0xFFFFFFFFFFFFFFE4 (-28)
The requested segment size is invalid, zero, or exceeds limits. See set_anonymous_segment_sz syscall.
TN_VM_ERR_SYSCALL_INSUFFICIENT_PAGES
0xFFFFFFFFFFFFFFE6 (-26)
Insufficient memory pages available for the requested allocation.
TN_VM_ERR_SYSCALL_UNFREEABLE_PAGE
0xFFFFFFFFFFFFFFE3 (-29)
Attempted to free a memory page that cannot be freed (e.g., system pages).
TN_VM_ERR_SYSCALL_INVALID_ADDRESS
0xFFFFFFFFFFFFFFEA (-22)
The provided memory address is invalid, out of bounds, or improperly aligned.
TN_VM_ERR_SYSCALL_INVALID_OFFSET
0xFFFFFFFFFFFFFFD9 (-39)
The provided offset is invalid or out of bounds for the target operation.

Object and Reference Errors

TN_VM_ERR_SYSCALL_INVALID_OBJ_REF_KIND
0xFFFFFFFFFFFFFFF3 (-13)
The object reference type is invalid or not supported for the requested operation.
TN_VM_ERR_SYSCALL_OBJ_NOT_WRITABLE
0xFFFFFFFFFFFFFFF2 (-14)
Attempted to modify an object that is not writable or is read-only.

System and Execution Errors

TN_VM_ERR_SYSCALL_BAD_PARAMS
0xFFFFFFFFFFFFFFEC (-20)
Invalid parameters provided to the syscall. Check parameter types, ranges, and requirements.
TN_VM_ERR_SYSCALL_CALL_DEPTH_TOO_DEEP
0xFFFFFFFFFFFFFFE8 (-24)
Maximum call depth exceeded. Prevents infinite recursion in invoke syscall chains.
TN_VM_ERR_SYSCALL_REVERT
0xFFFFFFFFFFFFFFE7 (-25)
Explicit revert requested. The program called exit syscall with revert flag.
TN_VM_SYSCALL_ERR_COMPUTE_UNITS_EXCEEDED
0xFFFFFFFFFFFFFFD8 (-40)
Compute units exhausted during syscall execution. See Compute Units.
TN_VM_ERR_SYSCALL_INVALID_FLAGS
0xFFFFFFFFFFFFFFD7 (-41)
Invalid flags provided to the syscall. See individual syscall documentation for valid flag values.
TN_VM_ERR_SYSCALL_INVALID_SIGNATURE
0xFFFFFFFFFFFFFFD4 (-44)
The provided signature is invalid or verification failed. This occurs when creating an EOA account with an invalid Ed25519 signature. See account_create_eoa syscall for signature requirements.

State and Proof Errors

TN_VM_ERR_SYSCALL_INVALID_STATE_PROOF
0xFFFFFFFFFFFFFFE9 (-23)
The provided state proof is invalid, corrupted, or does not match the current state.
TN_VM_ERR_SYSCALL_INVALID_PROOF_LEN
0xFFFFFFFFFFFFFFE0 (-32)
The proof length is invalid or does not match expected size requirements.
TN_VM_ERR_SYSCALL_INVALID_PROOF_SLOT
0xFFFFFFFFFFFFFFDF (-33)
The slot reference in the state proof is invalid or outdated.

Logging and Event Errors

TN_VM_ERR_SYSCALL_LOG_DATA_TOO_LARGE
0xFFFFFFFFFFFFFFE2 (-30)
The log data size exceeds maximum allowed length. See log syscall for size limits.
TN_VM_ERR_SYSCALL_EVENT_TOO_LARGE
0xFFFFFFFFFFFFFFE1 (-31)
The event data size exceeds maximum allowed length. See emit_event syscall for size limits.

Compression and Special Account Errors

TN_VM_ERR_SYSCALL_ACCOUNT_IN_COMPRESSION_TIMEOUT
0xFFFFFFFFFFFFFFDE (-34)
The account is in compression timeout and cannot be accessed. Wait for timeout period to expire.
TN_VM_ERR_SYSCALL_INVALID_SEED_LENGTH
0xFFFFFFFFFFFFFFDC (-36)
The seed length for account derivation is invalid. Seeds must meet specific length requirements.
TN_VM_ERR_SYSCALL_TXN_HAS_COMPRESSED_ACCOUNT
0xFFFFFFFFFFFFFFDB (-37)
The transaction contains compressed accounts that cannot be processed in this context.
TN_VM_ERR_SYSCALL_EPHEMERAL_ACCOUNT_CANNOT_CREATE_PERSISTENT
0xFFFFFFFFFFFFFFD6 (-42)
An ephemeral account attempted to create a persistent account, which is not allowed. Ephemeral accounts can only create other ephemeral accounts. See account_create_ephemeral syscall.

Error Handling

VM errors typically occur during program execution and may indicate issues with program logic, resource management, or invalid operations. Check the program implementation and ensure proper error handling for syscall operations.
Virtual machine-level errors (fault codes and syscall errors) typically occur during program execution and may indicate issues with program logic, resource management, or invalid operations. Check the program implementation and ensure proper error handling for syscall operations.
For runtime-level errors that occur outside of VM execution, see Runtime Errors.