Skip to main content

Errors

When a check fails, the contract panics with a short message and every state change of that receipt is reverted. In a transaction outcome the message appears as a function call error of the form Smart contract panicked: <message>. This page lists every message in the deployed code, grouped by the action that can produce it.

match_orders is different: a fill that fails a check is skipped, not panicked, and reported with a fill_skipped event. Those reasons are listed in Matching.

What a failure costs​

PathWhat happens on a panic
transfer + msg (mt_on_transfer)State reverted. intents.near refunds the full amount of every token to the sender's Intents balance
auth_call (on_auth)State reverted. Nothing moved, so nothing to refund. The intent batch still succeeds, because the call is detached
Price callbacks (on_liquidate_prices, on_withdraw_collateral_prices, on_match_prices)The callback's state is reverted. Nothing changed before the oracle call, so the action simply didn't happen. A liquidator is refunded in full
Payouts (mt_transfer to the user)Not a panic: on_payout credits the free balance and emits payout_failed. Withdraw it with the auth call withdraw

Gas burnt up to the failure is not refunded. Gas that was prepaid but not burnt is.

Refunds from mt_on_transfer​

mt_on_transfer returns one refund amount per token. intents.near resolves the transfer afterwards:

  • The call returns normally: each token's refund (usually "0", or the overpayment of a repay, or the unused part of a liquidate offer) goes back to the sender's Intents balance.
  • The call panics, or returns something malformed: intents.near refunds the full amount of every token, and the panic has reverted Setllend's state. An invalid order can never keep part of the funds.
  • liquidate returns a promise. If the callback panics, the promise fails and the liquidator gets the full amount back.

The refund happens in a later receipt of the same transaction, within a few seconds.

Any transfer action​

MessageMeaningFix
Caller must be the intents contractmt_on_transfer or on_auth was called by an account other than intents.nearGo through a NEAR Intents transfer or auth_call intent
Length mismatchtoken_ids and amounts differ in lengthOnly reachable by a malformed direct call
Amount must be positiveA token amount is 0Send a positive amount of every token
Invalid msgmsg isn't valid JSON for a known action: unknown action, missing field, a u64/u128 written as a number, an account ID with uppercase lettersCheck the format in Transfer messages. Lowercase EVM addresses
Expected exactly one tokenlend, repay, or liquidate carried zero or several tokensSend only USDC
Wrong tokenlend, repay, liquidate: the token isn't the debt token. borrow, add_collateral: a token isn't a listed collateral tokenUse the asset IDs from get_config and get_collateral_tokens
No tokensborrow or add_collateral with no tokensSend at least one collateral token
Collateral token is frozenborrow or add_collateral with a frozen tokenUse another collateral token
Duplicate tokenThe same token listed twiceList each token once

Placing orders (lend, borrow, sell_note)​

MessageMeaningFix
Unknown maturityThe maturity isn't in the contract's listPick one from get_maturities
Maturity has passedThe maturity is not in the futurePick a later maturity
Expiry has passedexpires_at is not in the futureUse a later expiry, or null
Principal must be positiveborrow with principal = 0Ask for a positive principal
No collateral in loanAuth call borrow: the signer has no loan with collateral in that maturityUse a transfer borrow with collateral, or add_collateral first (needs debt)
Value must be positivesell_note with value = 0Sell a positive value
Value exceeds free notessell_note for more than the value of the signer's free sharesRead get_notes and sell at most free_value. Shares locked in another sell_note order are not free

add_collateral​

MessageMeaningFix
No debtThe sender has no loan with debt in that maturityCollateral only goes into a loan with debt. To borrow, send a borrow with the collateral instead
Debt is overdueblock_time ≥ maturity + graceToo late to top up. Repay the debt before the keeper liquidates it

repay​

MessageMeaningFix
No debtNo loan for that borrower and maturity, or its debt is already zeroCheck get_loan and the borrower field. Nothing to repay

liquidate​

MessageMeaningFix
No loanNo loan for that borrower and maturityCheck get_loans
No debtThe loan has no debt (also when it was repaid while the oracle call was in flight)Nothing to liquidate
Loan is not liquidatableHealth factor ≥ 1 at conservative prices and not yet maturity + graceWait. Check health off-chain with the same prices first
No priceNo usable price for USDC or for one of the loan's tokens, frozen ones includedRetry when the oracle has fresh prices
Nothing to seizeEvery token's share rounds to 0 (a dust loan with a small repayment)Offer more USDC. A loan whose only collateral is too small to seize a single unit can only be cleared by a repayment
Math overflowA value product exceeds 512 bits (only with absurd amounts)Liquidate in smaller parts

cancel​

MessageMeaningFix
Order not foundThe order doesn't exist: already filled, cancelled, or never placedCheck get_orders_by_account
Not the order ownerThe signer didn't place this orderSign with the owner's account

withdraw_collateral​

MessageMeaningFix
Amount must be positiveamount = 0Withdraw a positive amount
No loanThe signer has no loan in that maturityCheck get_loans_by_account
Amount exceeds collateralMore than the loan holds of that token (also checked again in the callback)Read get_loan and withdraw at most that amount
Debt is overdueThe loan has debt and block_time ≥ maturity + graceThe collateral now secures overdue debt. Repay first
No priceThe loan has debt and a needed price is missing or invalidRetry later, or repay the debt so no price is needed
Withdrawal exceeds max LTVWhat is left would fail the max LTV check at conservative pricesWithdraw less, repay part of the debt, or add collateral first. Frozen tokens give no borrowing power

redeem​

MessageMeaningFix
Not maturedblock_time is before the maturityWait for maturity, or sell the notes with sell_note
Unknown maturityThe maturity isn't listedUse a maturity from get_maturities
Nothing to redeemThe signer has no free notes in that maturity (or asked for 0)Check get_notes. Cancel an open sell_note order to unlock its shares
Value exceeds free notesAsked for more than the value of the free sharesAsk for at most free_value, or null for all
Redemption pool is emptyNo repayments or liquidations have paid into the pool yetRetry after borrowers repay or the keeper liquidates overdue loans

withdraw​

MessageMeaningFix
Nothing to withdrawNo free balance of that token (or asked for 0)Check get_free_balances
Amount exceeds free balanceAsked for more than the free balanceAsk for at most the balance, or null for all

match_orders​

MessageMeaningFix
No fillsEmpty fills listSend at least one fill
Math overflowA fill's math overflowed. The whole batch revertsRemove the offending fill

Every other problem with a fill is a skip reason, not a panic.

Owner methods​

MessageMeaning
Owner onlyThe caller isn't owner_id
Maturity must be in the futureadd_maturity with a past timestamp
Maturity existsadd_maturity with a listed maturity
Debt token cannot be collateraladd_collateral_token with the USDC asset ID
Collateral token existsadd_collateral_token with a listed token
Feed ID is emptyadd_collateral_token with an empty feed_id
Require 0 < max_ltv < liq_thresholdInvalid ratios on add or update
Require liq_threshold * (1 + liq_bonus) < 100%A liquidation at the threshold couldn't pay the bonus
Unknown collateral tokenUpdate, freeze, or unfreeze of a token that isn't listed
Already frozen / Not frozenFreeze of a frozen token, unfreeze of an unfrozen one

Internal and framework messages​

These should not occur in normal use, but can appear in outcomes:

MessageSource
Method on_auth doesn't accept deposit (or another method name)A deposit was attached to a method that takes none. For auth_call, keep attached_deposit at 0
Method on_payout is private (or another callback)Someone other than the contract called a #[private] callback
Failed to deserialize input from JSON. Error: …Malformed arguments to a public method such as match_orders or a view
Failed to deserialize callback using JSON. Error: …The oracle returned something that doesn't parse. The callback reverts and nothing happens
Notes have no valuePricing new notes when V = 0 and S > 0. Fills check this first and skip with notes_wiped_out
Invalid priceA non-positive mid price in seizure. Validated prices are always positive
Division by zero, Wrong ask kind, Unknown collateral token (outside owner methods)Guards against bugs
Exceeded the prepaid gasNot a contract message: the call ran out of gas. Raise min_gas on the intent or the transaction's gas. See Gas