Skip to main content
To understand how to debug Soroban errors, first we must understand how the errors are associated with each step of the transaction flow, and the likely and common errors in each step of the transaction flow.

General Transaction Flow

The typical transaction submission process can be broken down into the following sequential steps, excluding external interactions like wallet interactions. Each step has its own set of potential errors:
  1. Transaction Simulation (optional):
    • What happens: This step involves executing the RPC endpoint simulateTransaction. The endpoint executes a transaction in ‘simulation’ mode of host and records the necessary ledger entries, CPU instructions, required authorizations. The end result is akin to running transactions in Core with maxed-out resources, unrestricted ledger access, and no fees.
    • Common failures: Errors typically involve exceeding the network limit or encountering contract logic issues.
  2. Core Accepts the Transaction:
    • What happens: Core evaluates each transaction to decide whether to accept or reject it. Rejected transactions are usually invalid or have insufficient fees, especially during high traffic periods.
    • Common failures: Invalid transactions, such as those with incorrect resource fees or overly high resource values, and invalid footprint are rejected. Other common errors include bad transaction signatures or insufficient funds in the source account. Valid transactions may only be rejected due to a low inclusion fee.
  3. Core Includes the Transaction in the Ledger:
    • What happens: Accepted transactions remain in Core’s memory until they are either included in the ledger or evicted.
    • Common failures: Transactions may fail to be included in the ledger if they have a low inclusion fee and need to be evicted during traffic surges to accommodate more transactions.
  4. Core Applies the Transaction to the Ledger:
    • What happens: Core executes the included transaction.
    • Common failures: This step has the widest range of potential errors. Failures could include accessing archived entries, resource depletion, accessing entries outside the specified footprint, or encountering logic failures within the contract.
For more information about fees, please visit Fees, Resource Limits, and Metering.

Detailed Soroban Errors

1. Transaction Simulation

Errors here are returned by the host and propagated through RPC. This doesn’t cover other possible errors (e.g. network errors, errors in RPC itself etc.)

2. Core Accepts the Transaction

The error is returned by the core immediately as a response to the transaction being sent and surfaced to the user through RPC. There are a few error-related fields in the Core’s response:
  • status contains one of the few coarse codes: it’s either “ERROR” for any transaction validation error, or one of the few special non-validation-related statuses.
  • result contains the encoded TransactionResult XDR that, in case of “ERROR” status, will contain the transaction-level error code starting with “tx”, such as txMALFORMED.
  • txFAILED transaction errors at this stage correspond to the operation-specific validation errors, so the operation result code should be examined.
  • diagnostics will contain additional error information in the Soroban diagnostic event format. This typically will be returned for txSOROBAN_INVALID transaction errors but may be used more extensively in the future.

3. Core Includes the Transaction in the Ledger

There are instances when the Core does not appear to include the transaction in the ledger, The following best practice is recommended:
It is strongly recommended that all transactions should include a time bound or ledger bound.

4. Core Applies the Transaction to the Ledger

The errors and diagnostic events are recorded in the transaction meta stream emitted by the Core instance when the ledger is being closed. Then, the RPC ingests the transaction metadata (tx meta) and allows developers to query the tx meta. When an error occurs, the Core stores a few error-related fields in the transaction result meta:
  • The transaction result (error) will be txFAILED for Soroban-related failures (or any operation failures in general). It is sometimes possible to get other tx$ERROR errors (such as txBAD_AUTH), but these are not related to Soroban and are more of an edge case.
  • The operation error will be one of INVOKE_HOST_FUNCTION_$ERROR, RESTORE_FOOTPRINT_$ERROR, and EXTEND_FOOTPRINT_TTL_$ERROR (corresponding to InvokeHostFunction, RestoreFootprint, and ExtendFootprintTTL operations). The operation errors are not very granular, and diagnostic events should typically be used to understand the exact error.
  • If the Core instance producing meta has Soroban diagnostics enabled (which it usually should), the meta will also contain diagnostic events with more detailed error information.
  • Note that there might be a few gaps in diagnostic event coverage. Since this is not a protocol change, Core may add more diagnostic events in future releases.
$OPERATION here refers to any one of the Soroban operations: INVOKE_HOST_FUNCTION, RESTORE_FOOTPRINT, and EXTEND_FOOTPRINT_TTL.