Error handling + retry strategies
Common errors and how to recover.
Tx submission errors
"Nonce stale: tx=X, state=Y"
Your local nonce is behind the chain. Re-fetch:
const acct = await client.chain.getAccount(wallet.address);
const tx = buildTransferTx(..., acct.nonce, ...);
"Insufficient balance"
Caller balance < amount + fee. Check balance first:
const acct = await client.chain.getAccount(wallet.address);
if (BigInt(acct.balance) < amount + fee) {
throw new Error("not enough OMBRA");
}
"Signature invalid"
Causes (in order of likelihood):
- Canonical JSON serializer reorders fields → use the SDK builders, don't roll your own
privateKeydoesn't matchfromaddress- Signed wrong bytes — must be
utf8(hexHash), not raw 32 bytes
"Tx already in mempool" (409)
Duplicate submission. Either:
- Your tx was already accepted — check
/api/mempool/or wait for inclusion - Different tx with same
hash— impossible unless you replayed