Classify the phase
If submission status is unknown, keep the input record reserved until its commitment state and transaction outcome are confirmed.
Pre-submit failures
These should be caught before proving or broadcasting:No sufficient token record
The AMM consumes one input record. Acquire a larger record through the token program or select a different amount. Do not attempt to pass several records.Wrong token record
Compare the record’s concrete token program with canonical pool token order and direction. Symbols and API metadata are not sufficient.Base-unit amount is invalid
Parse the user’s decimal input into an exact integer using the token metadata decimals. Reject a fractional base unit or a value outsideu128.
Invalid price limit
Refresh the slot and require a limit strictly below current price forzero_for_one or strictly above it for one_for_zero. A limit equal to current price is invalid.
Economically empty dust trade
If fee flooring reduces effective input to zero, the trade produces no output and returns the input. Raise the amount or decline the order.Swap rejection
Common finalize rejection causes include:
A rejected order should not create a usable pending output. Before reusing its input record, confirm rejection and record spend state with chain data. Client timeouts are not proof of rejection.
Accepted partial execution
An accepted swap can leave input unspent while still meetingamount_out_min. The claim returns that remainder in a token record.
Possible causes include:
- Price limit reached
- Five-iteration single-hop cap reached
- Three-iteration per-hop multi-hop cap reached
- Zero effective input after fee flooring
swap_outputs and show the original-input remainder. Do not automatically submit another swap for it. The user should receive the refund record, review current state, and authorize any follow-up order.
Accepted swap with no claim
If the swap is accepted, recovery is a claim, not a repeated swap.- Extract or reconstruct
swap_idfrom the accepted transition output. - Read
swap_outputs[swap_id]. - Recover the original signer and private blinding factor.
- Submit
claim_swap_outputwith exact mapping values and current signer freezelist proofs. - Confirm mapping removal.
- Decrypt and store returned token records.
Claim rejection
Confidential address mismatch
Use the same signer and factor that created the confidential address. A new factor cannot be substituted after the swap.Mapping value mismatch
Read the mapping again and copy every token and amount exactly. Do not use quoted output or a rounded display amount.Wrong router claim
Both core swap paths useclaim_swap_output. If an output or refund is wrapped, select the matching shield_swap_router.aleo claim adapter from the deployment asset registry.
Output already claimed
If the mapping is absent, inspect the prior claim transaction and local record scanner. Repeating the claim cannot recreate the removed entry.Token transfer failure
Confirm the concrete token programs, amounts, deployment availability, and record output handling. The AMM mapping may remain present after a rejected claim, allowing a corrected retry.Lost blinding recovery material
The normal claim path requires the original signer and private factor. The protocol does not provide an administrator recovery or redirect function for pending swap outputs. Wallets should persist encrypted recovery material before swap submission and include it in backup procedures. Investigator-owned compliance records support authorized attribution but are not spend credentials.Missing output records
If the claim is accepted but the wallet shows no funds:- Confirm the pending mapping was removed.
- Retrieve the accepted claim transaction outputs.
- Enumerate record, dynamic-record, and dynamic-ID record outputs.
- Decrypt with the signer’s view key.
- Preserve
_versionand_noncewhen parsing. - Match each record to its concrete token program.
- Rebuild the local record index without rebroadcasting the claim.
Multi-hop-specific recovery
- A route rejection is atomic. Do not assume earlier hops produced claimable intermediate assets.
- An accepted route returns final output and can return remaining original input.
- If a hop hit its iteration cap, a follow-up route begins from new public pool state and needs a new input record after the refund claim.
- A two-hop request still carries a padded third hop. Validate
hop_countbefore interpreting route telemetry. - Final minimum output applies to the route output, not to the original-input remainder.
Operational metadata failures
An off-chain token API outage can prevent a frontend from discovering symbols or constructing operator onboarding steps. It does not change an existing pool’s public token identifiers. The API seed script is separate from on-chain pool-creation allowlisting. After a metadata failure, confirm the environment, run a dry run, review each token program, and authorize on-chain actions separately.Incident record
For every material failure, retain:- Network, program ID, and edition
- Pool and route identifiers
- Transaction identifiers and terminal status
- Block heights used for quote and deadline
- Public request parameters
- Slot and relevant tick snapshots
- Local record handles, never plaintext in general logs
- Pending-output snapshot
- Client and SDK version
- Recovery action and result