Skip to content

Error Codes

When a transaction fails with a custom program error, the program returns a numeric code. Solace::ZarTrustlessEscrow::Errors translates that code (or its variant name) into a typed ProgramError carrying the code, name, and on-chain message.

Lookup

ruby
error = Solace::ZarTrustlessEscrow::Errors.from_code(6019)
error.code        # => 6019
error.error_name  # => "MediatedExpiryMustBeInFuture"
error.message     # => "MediatedExpiryMustBeInFuture: The expiry timestamp, when provided, must be in the future."

Solace::ZarTrustlessEscrow::Errors.from_name('InvalidMediator').code # => 6012

Both from_code and from_name return nil for an unknown input. ProgramError subclasses Solace::ZarTrustlessEscrow::Error, so it can be raised and rescued like any Ruby error.

The codes

Anchor assigns each TrustlessEscrowError variant a code of 6000 + its declaration index (so 6000 = 0x17706019 = 0x1783).

CodeNameMessage
6000MintInvalidThe mint provided does not match the escrow deposit's mint.
6001DepositorInvalidDepositor invalid.
6002DepositAmountInvalidThe deposit amount must be greater than 0.
6003SubsidyMismatchSubsidy mismatch.
6004InvalidAuthorityEither fee payer should be sponsor or depositor should be signer.
6005InvalidCloseAuthorityWhen a sponsor is present, the fee payer must be the sponsor.
6006ClaimAuthorityMustBeASignerThe claim authority must be a signer.
6007ClaimAuthorityIsInvalidThe claim authority provided does not match the escrow deposit's claim authority.
6008DepositorCannotBeClaimantThe depositor cannot be the claimant (use reclaim instruction instead).
6009ReclaimerMustBeDepositorThe reclaimer must be the depositor.
6010InvalidReclaimSignerThe reclaimer signer must be the depositor or the sponsor.
6011MediatorCannotBeDepositorOrBeneficiaryThe mediator cannot be the depositor or the beneficiary.
6012InvalidMediatorThe signer is not the mediator of the mediated escrow deposit.
6013MediatedDepositorCannotBeBeneficiaryThe depositor and beneficiary cannot be the same account.
6014InvalidReleaseRecipientThe recipient must be either the depositor or the beneficiary.
6015MediatedReclaimNotExpirableNo expiry is set, so only the mediator can distribute the funds.
6016MediatedReclaimNotYetExpiredThe mediated escrow deposit cannot be reclaimed before its expiry timestamp.
6017MediatedReclaimerMustBeDepositorOnly the depositor can reclaim the deposit after the expiry date.
6018InvalidRentCollectorThe rent collector provided does not match the mediated escrow deposit's rent collector.
6019MediatedExpiryMustBeInFutureThe expiry timestamp, when provided, must be in the future.

TIP

The codes are ported from the program's errors.rs (the source of truth). The TypeScript SDK's generated error file is stale and should not be used as a reference — it omits DepositAmountInvalid and all mediated errors.

Built on Solace