Skip to main content
Transactions can fail at different stages, each with a distinct error type. A robust flow handles all of them.

Stage 1: CheckTx Rejection (BroadcastTxError)

The node validates the transaction before adding it to the mempool. Common failures include invalid signatures, insufficient funds for fees, or unregistered message types. These throw a BroadcastTxError:
CheckTx rejections mean the transaction never entered a block and no gas was consumed.

Stage 2: Execution Failure (non-zero code)

If the transaction passes CheckTx but fails during execution (out of gas, business logic error, etc.), signAndBroadcast still returns a DeliverTxResponse — but with a non-zero code. Gas is consumed up to the point of failure.
assertIsDeliverTxSuccess throws an error if the transaction failed, making it useful for fail-fast workflows.

Stage 3: Timeout (TimeoutError)

If the transaction is not included in a block before the polling timeout expires, a TimeoutError is thrown. The transaction may still succeed later:

Full Error Handling Pattern

A robust transaction flow handles all three failure modes:

Error Summary

Next Steps

Error Classes

Detailed reference for all CosmJS error classes.

Events & Lookups

Read transaction events and look up past transactions.