OrbitDocs

Contract errors

Every way an Orbit invocation can fail, and what to do about it.

Orbit currently fails with host panics that carry a string message, not typed contracterror codes. Typed codes are on the roadmap.

Message / sourceEntrypointCauseFix
amount_per_interval must be positivecreate_vaultamount_per_interval <= 0Pass an amount greater than zero, in raw token units
interval_seconds must be greater than zerocreate_vaultinterval_seconds == 0Pass an interval of at least 1 second
Vault does not existpull_fundsNo create_vault for this (user, merchant)Subscriber completes the handshake
Too early to pull fundspull_fundsnow < last_pull + intervalRetry after the next eligible time
Auth errorallRequired signer missingSign with user, merchant or sender
Allowance error (SAC)pull_funds, batch_disburseAllowance too low, expired or revokedRe-approve Orbit on the token
Balance error (SAC)pull_funds, batch_disburseSource lacks tokensFund the wallet
Trustline error (SAC)pull_funds, batch_disburseReceiving G... account has no trustlineAdd a trustline for the asset
Arithmetic overflowpull_fundslast_pull + interval overflows u64Use a realistic interval_seconds

Catch errors before signing

Always simulate first. rpc.Server.prepareTransaction (JS) and stellar contract invoke --send=no (CLI) both surface these messages without spending a fee.

const sim = await server.simulateTransaction(tx);
if (rpc.Api.isSimulationError(sim)) {
  if (sim.error.includes("Too early to pull funds")) { /* reschedule */ }
}

On this page