When troubleshooting Hyperliquid order and cancel requests, the first thing to check is the JSON response envelope, not only the transport status. The official Exchange endpoint examples show 200: OK responses where the envelope contains "status":"ok", while an individual order or cancel can still fail inside response.data.statuses.
In other words, transport or envelope success does not mean every submitted order succeeded. For batched order and cancel actions, the documented behavior is that errors are usually returned as a vector with the same length as the batched request. Some payload-level failures are returned earlier during pre-validation, and in that case only one error is returned for the entire payload.
This guide uses the official Hyperliquid documentation available on 2026-11-10 to explain:
- How to read order and cancel response envelopes.
- Which documented batched error strings to expect.
- How to handle single-error pre-validation responses for a batch.
- How to debug signature errors without assuming a deposit is needed.
- Which nonce and API-wallet checks are documented.
1. Read the Exchange Response Envelope First
The Exchange endpoint is used for trading actions such as placing orders and canceling orders. The documented request is a POST to https://api.hyperliquid.xyz/exchange with a JSON body containing action, nonce, and signature.
For order submissions, the documented examples show three kinds of 200: OK response:
Successful resting order
{
"status": "ok",
"response": {
"type": "order",
"data": {
"statuses": [
{
"resting": {
"oid": 77738308
}
}
]
}
}
}
Order error inside an otherwise successful envelope
{
"status": "ok",
"response": {
"type": "order",
"data": {
"statuses": [
{
"error": "Order must have minimum value of $10."
}
]
}
}
}
Filled order
{
"status": "ok",
"response": {
"type": "order",
"data": {
"statuses": [
{
"filled": {
"totalSz": "0.02",
"avgPx": "1891.4",
"oid": 77747314
}
}
]
}
}
}
For cancel actions, the documented examples show:
Successful cancel
{
"status": "ok",
"response": {
"type": "cancel",
"data": {
"statuses": [
"success"
]
}
}
}
Cancel error inside an otherwise successful envelope
{
"status": "ok",
"response": {
"type": "cancel",
"data": {
"statuses": [
{
"error": "Order was never placed, already canceled, or filled."
}
]
}
}
}
The practical implication is that a bot should inspect response.data.statuses after every order or cancel submission. A response can be accepted at the envelope level while one or more submitted orders are rejected.
2. Batched Errors Are Usually Aligned to the Submitted Batch
The official Error responses documentation states that order and cancel errors are usually returned as a vector with the same length as the batched request.
That means if a bot submits three orders in one batch, the normal case is three status entries, one per submitted order. Each entry can indicate success, such as resting or filled, or an error string.
A reference handler should therefore:
- Check the envelope status.
- Read
response.typeto confirm whether the response is for an order or cancel action. - Iterate through
response.data.statuses. - Log the index, submitted order identifier if available, and the returned status or error string.
- Treat any entry containing
"error"as a business-level failure for that submitted item.
def log_order_statuses(payload, batch_size):
if payload.get("status") != "ok":
print("Envelope status:", payload.get("status"))
return
response = payload.get("response", {})
statuses = response.get("data", {}).get("statuses", [])
if not isinstance(statuses, list):
print("Unexpected statuses payload:", statuses)
return
if len(statuses) == batch_size:
for index, status in enumerate(statuses):
if isinstance(status, dict) and "error" in status:
print(f"Order {index} error: {status['error']}")
else:
print(f"Order {index} status: {status}")
elif len(statuses) == 1 and batch_size > 1:
# Pre-validation may return one error for the whole batch.
print("Whole-batch error:", statuses[0])
else:
print("Unexpected statuses length:", len(statuses))
This is a reference pattern based on the documented response shape, not a claim that it has been run against live markets.
3. Some Payload Failures Return One Error for the Entire Batch
The Error responses documentation also explains that some errors are a deterministic function of the payload itself. Those errors are returned earlier as part of pre-validation. In that case, only one error is returned for the entire payload, because some of those errors do not apply to a specific order or cancel.
Documented examples include:
- Empty batch of orders.
- Non-reduce-only TP/SL orders.
- Order too far from reference price.
- Some forms of tick size validation.
n times before being sent to the callback function, because the whole batch was rejected for the same reason.
Practical handling:
Like what you're reading? Try it yourself โ this link supports ChartedTrader at no cost to you.
Sign up on Hyperliquid โ- If
len(statuses) == len(submitted_orders), treat each status as aligned to one submitted item. - If
len(statuses) == 1and the batch contained multiple items, treat the single error as applying to the whole batch. - Do not silently assume the single error applies only to the first order.
- Log the submitted batch size alongside the returned status count.
4. Documented Batched Order and Cancel Errors
The table below lists documented batched error responses from the official Error responses page. The โDiagnosticโ column is a troubleshooting action based on the documented error string.
| Error source | Error type | Documented error string | Diagnostic |
|---|---|---|---|
| Order | Tick | Price must be divisible by tick size. | Check the assetโs tick size and ensure the submitted price conforms to it. |
| Order | MinTradeNtl | Order must have minimum value of $10. | Increase the order notional so it is at least $10. |
| Order | MinTradeSpotNtl | Order must have minimum value of 10 {quote_token}. | Increase the spot order size so the quote-token value is at least 10. |
| Order | PerpMargin | Insufficient margin to place order. | Reduce size, increase available margin, or review margin mode. See Hyperliquid Cross vs Isolated Margin. |
| Order | ReduceOnly | Reduce only order would increase position. | Check position side. If the order would open or increase a position, remove the reduce-only flag or change direction. |
| Order | BadAloPx | Post only order would have immediately matched, bbo was {bbo}. | Adjust the post-only price so it rests instead of crossing the book, or use a different time-in-force behavior. |
| Order | IocCancel | Order could not immediately match against any resting orders. | Check available liquidity. If resting is acceptable, use a resting order type instead of IOC. See Hyperliquid Order Not Filling? Slippage Fix. |
| Order | BadTriggerPx | Invalid TP/SL price. | Validate the trigger price for TP/SL orders. See Hyperliquid Take Profit & Stop Loss Orders. |
| Order | MarketOrderNoLiquidity | No liquidity available for market order. | Check the order book. Use a limit order or reduce size if liquidity is insufficient. |
| Order | PositionIncreaseAtOpenInterestCap | Order would increase open interest while open interest is capped | Reduce size or wait for open-interest conditions to change. |
| Order | PositionFlipAtOpenInterestCap | Order would increase open interest while open interest is capped | Reduce size or wait for open-interest conditions to change. |
| Order | TooAggressiveAtOpenInterestCap | Order rejected due to price more aggressive than oracle while at open interest cap | Adjust the price so it is not more aggressive than the oracle while the cap applies. |
| Order | OpenInterestIncrease | Order would increase open interest too quickly | Reduce size or pace order flow. |
| Order | InsufficientSpotBalance | (Spot-only) Order has insufficient spot balance to trade | Check the relevant spot balance before submitting the order. |
| Order | Oracle | Order price too far from oracle | Move the submitted price closer to the oracle price. |
| Order | PerpMaxPosition | Order would cause position to exceed margin tier limit at current leverage | Reduce position size or leverage so the resulting position stays within the margin tier limit. |
| Cancel | MissingOrder | Order was never placed, already canceled, or filled. | Reconcile open orders and fills before retrying. See Hyperliquid Missing Fills: Reconciliation Guide. |
asset value for perpetuals and spot markets, see Hyperliquid API Asset IDs: Spot, Builder Perps, and Token ID Mapping.
5. Debug Signature Errors Before Depositing
The official Signing documentation recommends using an existing SDK instead of manually generating signatures because there are many ways signatures can be wrong.
An incorrect signature can recover a different signer based on the signature and payload. The documented possible errors include:
"L1 error: User or API Wallet 0x0123... does not exist."
Must deposit before performing actions. User: 0x123...
The returned address may not match the public address of the wallet being used to sign. The documentation also notes that the returned address can change for different inputs.
Important troubleshooting order:
- Check whether the recovered address matches the intended signer.
- Do not deposit before confirming that the recovered address is the intended user or API wallet address.
- If the recovered address is wrong, debug the signature construction first.
- Using the wrong signing scheme. The Python SDK methods are
sign_l1_actionversussign_user_signed_action. - Getting the order of fields wrong for msgpack.
- Issues with trailing zeroes on numbers.
- Issues with uppercase characters in address fields. The documentation recommends lowercasing any address before signing and sending.
- Assuming the signature is correct because local recover-signer returns the correct address. The payload for recover signer is constructed based on the action and does not necessarily match the actual action payload.
For SDK-based implementation context, see Hyperliquid Python SDK Tutorial: Build a Bot.
6. Check Nonce and API-Wallet Behavior
Nonce and API-wallet issues can produce confusing behavior, especially when using automated strategies. The official Nonces and API wallets documentation provides several documented checks.
API wallets are for signing, not querying
API wallets, also called agent wallets in the docs, can be approved by a master account to sign on behalf of the master account or sub-accounts.
They are only used to sign. To query account data associated with a master or sub-account, pass the actual address of that account. A documented pitfall is using the agent wallet for queries, which can lead to an empty result.
For setup and revocation context, see:
Nonces are tracked per signer
On Hyperliquid, the 100 highest nonces are stored per address. Every new transaction must have a nonce larger than the smallest nonce in that set and must never have been used before.
Nonces are tracked per signer:
- If signed with the private key of the address, the signer is the user address.
- If signed with an API wallet, the signer is the agent address.
(T - 2 days, T + 1 day), where T is the unix millisecond timestamp on the block of the transaction.
The Exchange endpoint documentation recommends using the current timestamp in milliseconds for nonce.
Do not reuse API wallet addresses after deregistration
The documentation strongly suggests not reusing API wallet addresses programmatically. Once an agent is deregistered, its used nonce state may be pruned. Previously signed actions can be replayed once the nonce set is pruned.
API wallets and their associated nonce state may be pruned when:
- The wallet is deregistered.
- The wallet expires.
- The account that registered the agent no longer has funds.
Use separate API wallets for parallel subaccounts
Because nonces are stored per signer, separate subaccounts signed by the same API wallet share the nonce tracker of that API wallet. If multiple subaccounts are used in parallel, the documentation recommends generating separate API wallets under the master account and using one API wallet for each subaccount.
Batching and nonce counters
For automated strategies, the documentation suggests:
- Use an API wallet per trading process.
- Periodically batch order and cancel requests, with a suggested interval of 0.1 seconds.
- Batch IOC and GTC orders separately from ALO orders because ALO order-only batches are prioritized by validators.
- Use an atomic counter to ensure a unique nonce for the address.
- Fast-forward the atomic counter to current unix milliseconds if needed.
For rate-limit and user-limit behavior, see Hyperliquid API Rate Limits & User Limits. For real-time data handling, see Hyperliquid API Websocket Guide for Developers and Hyperliquid Websocket Reconnect Fix.
7. Practical Error-Handling Checklist
A useful troubleshooting checklist for Hyperliquid API errors is:
- Log the full request and response. Include action type, batch size, nonce, envelope status, and statuses.
- Separate envelope success from order success. A
status: okenvelope can still contain per-order errors. - Handle batch alignment. Expect one status per submitted item in the normal batched case.
- Handle whole-batch pre-validation errors. A single error may apply to the entire batch.
- Check documented error strings. Match the returned error string to the documented meaning before changing strategy logic.
- Verify signature recovery. For signature-related errors, confirm the recovered address before considering deposits.
- Check API-wallet usage. Use the agent wallet for signing and the actual account address for queries.
- Check nonce state. Ensure nonces are unique, within the documented time window, and not affected by pruned or reused agent wallets.
- Reconcile before retrying. For
MissingOrderor missing fills, check order history and open orders before resubmitting.
Risk Warning
Risk Warning: Crypto trading involves substantial risk of loss. Never invest more than you can afford to lose. This is not financial advice.
Sources
- Hyperliquid Docs: Error responses
- Hyperliquid Docs: Exchange endpoint
- Hyperliquid Docs: Signing
- Hyperliquid Docs: Nonces and API wallets
Continue with Hyperliquid
Browse the Hyperliquid guide hub for the complete user journey.