Errors
This page is also Markdown, for agents: /plach/reference/errors.md, and /llms.txt lists every page.
When Plach fails a call, the engine’s error contains [slimedragon.near/xyk] Dex panicked: followed by the message, and nothing in the call changes. Some messages come after a line like panicked at dexes/xyk/src/lib.rs:262:17:, so match the message itself rather than Dex panicked: <message>. See the engine’s errors for everything around it, like balances and registrations.
Any call
Section titled “Any call”| Message | Cause |
|---|---|
This method can only be called directly, not in a transfer call |
The call doesn’t come directly from the caller: a DexCall in the operations of a deposit |
Invalid args, or Failed to deserialize input from Borsh for a dex_view |
args isn’t the Borsh of the method’s arguments. See Types |
Pool not found, Pool <id> not found |
No pool with this ID |
No assets should be attached, No assets other than NEAR should be attached, No assets other than the two pool assets should be attached |
attached_assets has assets the method doesn’t take |
Not enough near attached for storage. Required: <cost>, attached: <amount> |
Attach more NEAR. What’s left is sent back |
| Message | Cause |
|---|---|
Invalid message |
message isn’t a route |
No routes, Route has no pools |
An empty list of routes or pools |
No pools created |
A route through the last created pool before any pool exists |
Route fractions must add up to 100% |
The fractions of the routes don’t add up to 1000000 |
Pool <id> doesn't have <asset> |
A pool of the route doesn’t have the asset that comes into it |
Route doesn't end in asset out |
The last pool of a route doesn’t output asset_out |
Pool is empty |
The pool has no liquidity |
Amount must be greater than 0 |
A swap of 0, a split so small that a route got 0, or a pool of a route that put out 0 |
Amount must be less than out balance |
An exact output that would take all of the pool’s balance |
Quote asset liquidity can't go lower than the initial phantom liquidity |
A sale in a launch pool for more of the quote asset than buyers put in |
Fee discount expired |
The fee discount is past its block height. Get a new quote |
Fee discount is for another route, Fee discount is for other assets, Fee discount is for another amount, Fee discount is for another trader |
The swap isn’t the one the discount was signed for |
Fee discount signature verification failed |
The signature isn’t by the fee discount signer. An Ed25519 signature must be exactly 64 bytes: another length fails with called `Result::unwrap()` on an `Err` value |
Fee discount can't exceed 100% |
The signed fee_discount is above 1000000 |
Fee discounts are disabled on this dex |
There’s no fee discount signer |
Liquidity
Section titled “Liquidity”| Message | Cause |
|---|---|
User has not registered using register_liquidity |
Register for the pool’s shares first |
Liquidity registration is only needed for public pools |
register_liquidity on a private or launch pool |
Asset 1 not found, Asset 2 not found |
add_liquidity without one of the pool’s assets attached |
Amounts must be greater than 0, Can't mint zero shares |
Too little attached for any shares |
Slippage error |
Fewer shares than min_shares_received, or less of an asset than min_assets_received |
User has no shares, Not enough shares to remove |
Removing more shares than you have, or from a public pool you have no shares in |
Can't remove zero shares |
shares_to_remove is Some(0) |
Only pool owner can add liquidity, Only pool owner can remove liquidity |
The pool is private and you’re not its owner |
Min shares received must not be specified for private pools |
Private pools have no shares |
Min shares received must not be specified for new pools |
min_shares_received when adding to a public pool that has no liquidity left |
Shares must be less than 1000000000000000000. 1000000000000000000 means remove 100% of pool |
shares_to_remove above 1018 in a private pool |
Pool is locked and liquidity cannot be removed |
The private pool is locked |
Launch pools don't support adding liquidity after creation, Launch pools don't support removing liquidity after creation |
Launch pools only have the liquidity they were created with |
Only public pools have liquidity providers |
set_liquidity_fee_payout or collect_liquidity_fees on a private or launch pool |
Liquidity fees are already taken this way |
set_liquidity_fee_payout with the payout you have |
| Message | Cause |
|---|---|
Assets must be different |
Both assets of create_pool are the same |
Only NEAR, NEP-141, and NEP-245 assets are supported |
An NFT as a pool asset |
Near should be attached for storage |
create_pool without NEAR attached |
No assets other than NEAR and initial liquidity should be attached, No assets other than NEAR and launched asset should be attached |
create_pool with assets it doesn’t take |
Public pools must be created with initial liquidity |
initial_liquidity is None for a public pool |
Public pools must be created with the creator's fee payout type specified |
creator_fee_payout_type is None for a public pool |
Only public pools have liquidity providers that take fees |
creator_fee_payout_type for a private or launch pool |
Too many pools |
Pool IDs go up to 4294967294 |
Initial liquidity amounts must be greater than 0 |
An amount of 0 in initial_liquidity |
Attached <asset> must be equal to its initial liquidity |
Attach exactly the initial liquidity of each asset |
Not enough NEAR attached for initial liquidity and storage |
The attached NEAR is less than the NEAR of initial_liquidity. If it covers the liquidity but not the storage, the error is Not enough near attached for storage |
Launch pools take the launched asset from attached assets, not initial liquidity |
initial_liquidity for a launch pool. Attach the token instead |
Launched asset not found, Launched asset amount must be greater than 0 |
A launch pool without the launched token attached |
Phantom liquidity must be greater than 0 |
A launch pool needs phantom liquidity |
First asset in Launch pools must be NEAR |
A LaunchV1 pool not quoted in NEAR. Use LaunchLatest |
Only pool owner can edit fees, Only pool owner can lock the pool |
You’re not the pool’s owner |
Fees cannot be edited for public pools, Fees cannot be edited for launch pools |
Only private pools’ fees can change |
Pool is locked |
A locked pool’s fees can’t change |
Public pools cannot be locked, Launch pools are locked by default |
Only private pools can be locked |
| Message | Cause |
|---|---|
Too many fee receivers |
More than 20 |
Fee must be less than 1000000, Fee must be less than 1000000 per receiver |
A fee of 100% or more |
Fees must add up to at most 900000 |
The fees add up to more than 90% |
Protocol fee receiver can't be set by users |
Protocol as a receiver. An Account receiver for plach.intear.near fails earlier, with Invalid args |
Only liquidity providers can reinvest their fees |
An Account receiver with Reinvest |
Scheduled fee start time must be before end time, Start fee fraction must be greater than end fee |
A scheduled fee must go down over time |
Start fee fraction must be less than 1000000 |
A scheduled fee starting at 100% or more |
Min fee fraction must be less than max fee fraction, Max fee fraction must be less than 1000000, Dynamic fee configuration is not implemented yet |
Dynamic fees aren’t supported. An invalid one fails with one of the first two |
Asset <asset> already registered |
register_fee_assets with an asset you’re registered for, by an earlier call, as an OnlyOwner receiver paid in it, or as a liquidity provider of a pool with it |
<account> has no fees in <asset> that anyone can claim |
claim_fees_anyone for an account that isn’t an Anyone receiver in that asset |
Only owner can set the fee discount signer |
set_fee_discount_signer by anyone but slimedragon.near |