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
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 # => 6012Both 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 = 0x1770 … 6019 = 0x1783).
| Code | Name | Message |
|---|---|---|
| 6000 | MintInvalid | The mint provided does not match the escrow deposit's mint. |
| 6001 | DepositorInvalid | Depositor invalid. |
| 6002 | DepositAmountInvalid | The deposit amount must be greater than 0. |
| 6003 | SubsidyMismatch | Subsidy mismatch. |
| 6004 | InvalidAuthority | Either fee payer should be sponsor or depositor should be signer. |
| 6005 | InvalidCloseAuthority | When a sponsor is present, the fee payer must be the sponsor. |
| 6006 | ClaimAuthorityMustBeASigner | The claim authority must be a signer. |
| 6007 | ClaimAuthorityIsInvalid | The claim authority provided does not match the escrow deposit's claim authority. |
| 6008 | DepositorCannotBeClaimant | The depositor cannot be the claimant (use reclaim instruction instead). |
| 6009 | ReclaimerMustBeDepositor | The reclaimer must be the depositor. |
| 6010 | InvalidReclaimSigner | The reclaimer signer must be the depositor or the sponsor. |
| 6011 | MediatorCannotBeDepositorOrBeneficiary | The mediator cannot be the depositor or the beneficiary. |
| 6012 | InvalidMediator | The signer is not the mediator of the mediated escrow deposit. |
| 6013 | MediatedDepositorCannotBeBeneficiary | The depositor and beneficiary cannot be the same account. |
| 6014 | InvalidReleaseRecipient | The recipient must be either the depositor or the beneficiary. |
| 6015 | MediatedReclaimNotExpirable | No expiry is set, so only the mediator can distribute the funds. |
| 6016 | MediatedReclaimNotYetExpired | The mediated escrow deposit cannot be reclaimed before its expiry timestamp. |
| 6017 | MediatedReclaimerMustBeDepositor | Only the depositor can reclaim the deposit after the expiry date. |
| 6018 | InvalidRentCollector | The rent collector provided does not match the mediated escrow deposit's rent collector. |
| 6019 | MediatedExpiryMustBeInFuture | The 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.