Tronergydocs

Errors

The error format and every error code the API returns, with what to do.

Error format

{
  "ok": false,
  "error": "TX_EXPIRED",
  "message": "Transaction expired",
  "hint": "Call POST /construct-tx to build a fresh transaction."
}
FieldMeaning
okAlways false on errors.
errorA code such as INSUFFICIENT_BALANCE. A few older endpoints put a short sentence here instead; those are listed below with their sentence. Match on this.
messageHuman-readable detail. Optional.
hintWhat to do next. Optional.
detailsField-level problems on validation errors.
codeSet on some 403 and 422 answers, for example SESSION_REQUIRED.

A validation error looks like this:

{
  "ok": false,
  "error": "Validation failed",
  "details": { "formErrors": [], "fieldErrors": { "idempotencyKey": ["Invalid uuid"] } }
}

There are two kinds of errors:

  • Request errors come back right away. Nothing was charged or broadcast.
  • Operation errors happen later, while an accepted relay runs. The operation ends failed with an errorCode. See Operation errors.

For retry patterns, see the Errors guide.

Auth and access

Statuserror / codeWhat to do
401Authentication requiredSend a valid key in x-api-key or Authorization: ApiKey. Missing, wrong, expired and revoked keys all land here.
403Insufficient permissionsYour user's role lacks the permission for this endpoint.
403code: "SESSION_REQUIRED"This action needs a signed-in dashboard session. Do it in the dashboard.
404Operation not found, Batch not found, Account not found, Key not found, Not foundUnknown ID or not yours. Not found usually means the ID is not a UUID.

Validation

StatuserrorWhat to do
422Validation failed (batch: VALIDATION_FAILED)Fix the body. Read details.fieldErrors.
422Invalid query parametersFix the query string.
400Invalid JSON bodyConstruct transaction and create API key only. Other endpoints read broken JSON as {} and answer 422.
422INVALID_PAYLOADpayload is empty or a field is wrong. message names it.
422UNSUPPORTED_FIELDRemove adjustmentPolicy and send the exact energy_amount.
422ENERGY_AMOUNT_BELOW_MINIMUMRetry delegate_energy with details.suggestedEnergyAmount.

Pricing

Only the public Pricing endpoints return these.

StatuserrorWhat to do
503PRICE_UNAVAILABLENo energy provider can be priced right now. Try again in a minute.
502PRICE_QUOTE_FAILEDThe current price could not be calculated. Try again.
400Invalid queryPrice history only. Fix hours or energy.
502Failed to load price historyPrice history only. Try again.
422Invalid query parametersRate only. Fix energy: a whole number from 10,000 to 10,000,000.
404Not foundRate only. The org slug does not exist.
400org is requiredPrice history only. Send org.
404Organization not foundPrice history only. The org slug does not exist.

Signed transactions

StatuserrorWhat to do
400TX_MALFORMEDInclude the full signed TronWeb transaction object.
400TX_NOT_SIGNEDSign it in the wallet first.
400TX_EXPIREDExpired or too close to expiry. Build a new one and sign again.
400TX_EXPIRING_SOONExpires before this relay can finish (the message gives the seconds needed). Sign again with a longer expiration, or use construct-tx.
400INSUFFICIENT_SENDER_BALANCEThe sender does not hold the TRX the transaction sends. Fund it, then sign again.
400TX_DECODE_FAILEDSign again. Do not change the object after signing: raw_data_hex must be present, txID must be its hash, and raw_data must match it.
400TX_SENDER_MISMATCHSender differs from userAddress, or fee and user transactions have different senders. Sign both with one wallet.
400FEE_RECIPIENT_MISMATCHThe fee transaction pays the wrong address. Use feeRecipient from the estimate.
400TX_MISMATCHSwap: sign every transaction from construct-tx, in order.
422SIGNATURE_MISMATCHSign with the wallet that owns the sender address.
422SIMULATION_REVERTEDexecute only. The node shows the transaction would revert (for example, the sender lacks the tokens). Nothing was held or charged. Fix the cause, sign again. estimate never returns this; it sets simulation.reverted instead.

Balance and availability

StatuserrorWhat to do
422INSUFFICIENT_BALANCETop up your balance, then retry. See Billing.
503RELAYER_UNDERFUNDEDTemporary platform problem. Retry later with the same idempotency key.
422NO_PROVIDER, PROVIDER_NOT_FOUND, PROVIDER_NOT_CONFIGUREDNo quote is available right now, or chain / mode is unknown. Retry later or lower the energy amount.
422NO_SANDBOX_PROVIDERSandbox cannot quote this request. Try live or contact support.
503TRON_BALANCE_CHECK_UNAVAILABLE, SUNSWAP_RPC_RATE_LIMITED, SUNSWAP_BALANCE_CHECK_UNAVAILABLEThe TRON network is busy. Retry in a few seconds.
502ESTIMATION_FAILED, CONSTRUCT_FAILED, RELAY_FAILED or any other codeUpstream failure. Retry shortly.
502no error; body has operationId and "status": "failed"Execute: the relay could not start and was not broadcast. Retry with a new idempotency key.
503retrySafe: falseDatabase outage, outcome unknown. Check the current state, or retry with the same idempotency key.
500Operation failedUnexpected error. Retry with the same idempotency key.

Idempotency

StatuserrorWhat to do
409IDEMPOTENCY_KEY_CONFLICTThe key is used by another user of your organization. Use a new UUID.
409IDEMPOTENCY_KEY_REUSEDBatch key reused with different items. Use a new batchIdempotencyKey.

Rate limits

StatuserrorWhat to do
429Rate limit exceeded. Maximum 100 execute requests per minute.Wait Retry-After seconds.
429Rate limit exceeded. Maximum 30 estimate requests per minute.Wait Retry-After seconds.
429Rate limit exceeded. Maximum 30 construct-tx requests per minute.Wait Retry-After seconds.
429RATE_LIMITEDBatch: too many calls or not enough execute points. Wait up to a minute.
429Rate limit exceeded. Maximum 25 withdrawal requests per hour.Wait before withdrawing again.

Construct transaction

StatuserrorWhat to do
422Fee payment is not available right now. Please contact support.Token fee modes are not set up for your account. Contact support.
422Missing fee token contractSend feeTokenContract for token_pay.
422Missing fee amount, Missing or invalid native TRX fee amountSend feeAmountSun as a positive whole number.
422Invalid callValue: must be a whole number of sun within rangeFix callValue.
500Failed to construct transaction, Failed to construct fee transaction, Failed to construct user transactionCheck the contract, selector and parameters, then retry.

Operations and batches

StatuserrorWhat to do
409Operation is already <status> and can no longer be cancelled., Operation is no longer in a cancellable stateCancel works only while pending or reserved. Read the operation to see where it is.
502Failed to fetch operation statisticsRetry shortly.
413BODY_TOO_LARGEKeep the batch body under 8 MB.
422BATCH_TOO_LARGESplit into smaller batches (25 items by default).
422UNSUPPORTED_MODEsunswap_swap cannot be batched.
409BATCH_NOT_RETRYABLEWait until the batch finishes dispatching.
409NO_RETRYABLE_ITEMSNothing to retry.
409RETRY_BUDGET_EXHAUSTEDItems were retried 3 times. Submit them in a new batch.
Statuserror / codeWhat to do
404No deposit address found for this chain and environmentCreate one with GET /api/payment_gateways/portal/deposit.
422Deposits are not available for this network right now.Contact support.
500Failed to resolve deposit addressRetry shortly.
422Invalid payloadAlerts PUT: fix the body.
502Failed to fetch alert config, Failed to update alert configRetry shortly.
422Insufficient balance for withdrawalWithdraw less.
422Minimum withdrawal amount is 1000000Withdraw at least 1 TRX (1000000 sun).
422Maximum single withdrawal exceededWithdraw at most 100,000 TRX per request. Split larger amounts.
422Invalid TRON destination addressThe address checksum is wrong. Copy the address again.
409This withdrawal was previously cancelled. Use a new idempotencyKey to retry.Use a new idempotencyKey.
409This idempotencyKey was already used for a different withdrawal. Use a new idempotencyKey.The key was used with another amount, address or user. Use a new idempotencyKey.
422limit_reachedYou have 25 usable API keys. Revoke one first.
404Missing or invalid id parameterSend ?id= with the key's UUID.
422code: "LINK_LIMIT_REACHED"You have 50 active node links. Revoke one first.

Swap

StatuserrorWhat to do
422SYNC_UNSUPPORTEDDo not send sync: true for sunswap_swap.
409DRAFT_EXPIRED, DRAFT_STALEBuild the step again with construct-tx, sign and execute. DRAFT_STALE can also mean the draft was priced for another account, or before a platform update.
409SUNSWAP_OPERATION_IN_PROGRESSA step is still running. Wait for it.
409SUNSWAP_SESSION_COMPLETEDThis session's swap is done. Estimate again without session_id to start another.
409SUNSWAP_SESSION_REPRICE_REQUIREDThe session's price is out of date for your account. Call estimate again with the same session_id, then construct-tx.
503SUNSWAP_RPC_RATE_LIMITED, SUNSWAP_BALANCE_CHECK_UNAVAILABLEThe network is busy. Retry shortly.
502SUNSWAP_UNSIGNED_TX_INVALIDThe step could not be built. Retry construct-tx.
422SUNSWAP_INVALID_INTENT, SUNSWAP_RECIPIENT_MISMATCH and the other SUNSWAP_* codesThe swap cannot go ahead as asked. Read message. See Swap.

Operation errors

These appear in errorCode on a failed operation. The list is not complete: treat unknown codes as a generic failure and show errorMessage.

errorCodeMeaning
INSUFFICIENT_BALANCE, BUDGET_CAP_EXCEEDEDYour balance or monthly budget cap could not cover the relay.
RESERVE_FAILEDThe cost could not be held on your balance.
ESTIMATION_FAILEDRe-quoting failed while running.
PROVIDER_NOT_FOUNDNo quote was available when the relay ran.
RELAY_STEP_FAILED, RELAY_FAILEDA step failed and no more specific reason is known.
WORKFLOW_START_FAILEDThe relay could not start.
STUCK_OPERATIONThe relay stopped making progress and was closed.
WORKFLOW_EXHAUSTEDRetries ran out.
UNKNOWN_ERRORUnexpected failure.

Before you resubmit a failed relay, check txHash on the chain. If your user's transaction landed, do not send it again. A resubmit needs a new idempotency key.