OrbitDocs

Contract errors

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

Edit this page on GitHub

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_funds, cancel_vaultNo vault for this (user, merchant): never created, or already cancelledSubscriber completes the handshake with create_vault
Too early to pull fundspull_fundsnow < last_pull + intervalRetry after the next eligible time
splits must not be emptybatch_disbursesplits has no entriesProvide at least one recipient and amount
split amount must be positivebatch_disburseAny split has amount <= 0Pass an amount greater than zero, in raw token units
Total amount overflowbatch_disburseSum of all split amounts overflows i128Keep the total batch payout within i128::MAX
Auth errorall except get_vaultRequired 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