Error Reference

Error codes, exit codes, and recovery hints for the AgentsWallets CLI.

Error envelope

All errors are returned as JSON on stdout with a consistent structure:

{
  "ok": false,
  "data": null,
  "error": {
    "code": "ERR_INSUFFICIENT_FUNDS",
    "message": "Need 10 USDC, have 2.3",
    "details": { "required": "10", "available": "2.3", "token": "USDC" },
    "recovery_hint": "Top up wallet. Check balance with `aw wallet balance <name>`."
  },
  "meta": { "request_id": "req_abc" }
}

Exit codes

CodeCategoryDescription
0SuccessCommand completed successfully
1Business errorInvalid params, policy violation, insufficient balance
2System errorNetwork, RPC, or third-party failure
3Auth errorSession expired or wrong password

Error codes

CodeExitMessageRecovery hint
ERR_NOT_INITIALIZED1Data store not initializedRun aw init to initialize.
ERR_NEED_UNLOCK3Session expired or not unlockedRun aw unlock to start a session.
ERR_AUTH_FAILED3Master password incorrectCheck master password. Run aw unlock to retry.
ERR_INVALID_PARAMS1Invalid command argumentsCheck command arguments and input requirements.
ERR_WALLET_NOT_FOUND1Wallet not foundCheck wallet name with aw wallet list.
ERR_MARKET_NOT_FOUND1Market ID not foundVerify market ID with aw predict markets.
ERR_INVALID_AMOUNT1Invalid amount valueProvide a positive numeric amount.
ERR_INSUFFICIENT_FUNDS1Not enough fundsTop up wallet. Check balance with aw wallet balance <name>.
ERR_DAILY_LIMIT_EXCEEDED1Daily spending limit reachedWait for daily reset (UTC midnight) or raise limit with aw policy set.
ERR_PER_TX_LIMIT_EXCEEDED1Amount exceeds per-tx limitReduce amount or raise per-tx limit with aw policy set.
ERR_TX_COUNT_LIMIT_EXCEEDED1Max transactions per day reachedWait for daily reset (UTC midnight) or raise max_tx_per_day.
ERR_APPROVAL_REQUIRED1Amount exceeds approval thresholdRequires human approval or lower require_approval_above.
ERR_IDEMPOTENCY_CONFLICT1Idempotency key already used with different paramsUse a new idempotency key or check the original result.
ERR_RPC_UNAVAILABLE2RPC endpoint unavailableCheck network or set AW_RPC_URL. Retry with --timeout <ms>.
ERR_POLYMARKET_FAILED2Polymarket operation failedRetry the operation. Check aw health for diagnostics.
ERR_POLYMARKET_AUTH2Polymarket authentication errorRe-run aw predict approve-set to refresh approvals.
ERR_POLYMARKET_TIMEOUT2Polymarket CLI timed outIncrease timeout with AW_POLY_TIMEOUT_MS or retry.
ERR_TX_FAILED2Transaction failed on-chainCheck explorer for details. Retry or adjust gas settings.
ERR_POLYMARKET_CLI_NOT_FOUND2Polymarket CLI not installedInstall the Polymarket CLI. See prerequisites in Quick Start.
ERR_OKX_AUTH2OKX API authentication failedCheck OKX API credentials. Run aw health for diagnostics.
ERR_OKX_API_FAILED2OKX API request failedRetry the operation. Check aw health for OKX API status.
ERR_OKX_TIMEOUT2OKX API request timed outRetry with backoff. Check network connectivity.
ERR_OKX_QUOTE_FAILED2Failed to get swap/bridge quoteCheck token pair and amount. Retry the operation.
ERR_SWAP_FAILED2Token swap failedCheck explorer for details. Verify token pair and liquidity.
ERR_BRIDGE_FAILED2Cross-chain bridge failedCheck bridge status with aw bridge status. Retry if needed.
ERR_HL_API_FAILED2Hyperliquid API request failedRetry the operation. Check aw health for Hyperliquid status.
ERR_HL_ORDER_FAILED1Hyperliquid order rejectedCheck order parameters (size, leverage, margin).
ERR_HL_INVALID_ASSET1Invalid perpetual assetCheck available assets with aw perp assets.
ERR_HL_INSUFFICIENT_MARGIN1Insufficient margin for positionReduce position size or leverage. Check account with aw perp account.
ERR_HL_BUILDER_FEE_FAILED2Failed to apply builder feeRetry the operation.
ERR_RED_LINE_BLOCKED1Operation blocked by Security Guard red-line ruleReview the operation. Use --yes to confirm after careful review.
ERR_RATE_LIMITED1Transaction rate limit exceededWait before retrying. Check rate limit status.
ERR_BLACKLISTED_ADDRESS1Address is blacklistedRemove from blacklist with aw security blacklist remove if legitimate.
ERR_BASELINE_TAMPERED1Configuration baseline mismatch detectedInvestigate configuration changes. Re-init baseline with aw security baseline init.
ERR_PREFLIGHT_FAILED1Security preflight check failedReview security status with aw security status.
ERR_INTERNAL_ERROR2Unexpected internal errorRetry. If persistent, check aw health for diagnostics.

Handling errors in agents

Exit code strategy

import subprocess, json
 
result = subprocess.run(
    ["aw", "send", "--wallet", "bot", "--to", "0x...",
     "--amount", "10", "--token", "USDC", "--json"],
    capture_output=True, text=True
)
 
if result.returncode == 0:
    data = json.loads(result.stdout)["data"]
    print(f"tx_hash: {data['tx_hash']}")
 
elif result.returncode == 3:
    # Auth error — re-unlock and retry
    subprocess.run(["aw", "unlock", "--json"], env={**os.environ, "AW_MASTER_PASSWORD": pw})
    # retry the original command...
 
elif result.returncode == 1:
    error = json.loads(result.stdout)["error"]
    print(f"Error: {error['code']}{error['recovery_hint']}")
 
elif result.returncode == 2:
    # System error — retry with backoff
    time.sleep(5)
    # retry...

Common patterns

ScenarioError codeAgent action
Session expiredERR_NEED_UNLOCKRe-run aw unlock, then retry
Over spending limitERR_DAILY_LIMIT_EXCEEDEDWait for UTC midnight or reduce amounts
Token not allowedERR_INVALID_PARAMSCheck policy with aw policy show
Network downERR_RPC_UNAVAILABLERetry with exponential backoff
Insufficient fundsERR_INSUFFICIENT_FUNDSCheck balance, request top-up
Duplicate transactionERR_IDEMPOTENCY_CONFLICTUse a new idempotency key
Swap failedERR_SWAP_FAILEDCheck token pair, liquidity, retry
Bridge failedERR_BRIDGE_FAILEDCheck aw bridge status, retry
Security guard blockERR_RED_LINE_BLOCKEDReview and use --yes to confirm
Blacklisted addressERR_BLACKLISTED_ADDRESSReview blacklist with aw security blacklist list
Config tamperedERR_BASELINE_TAMPEREDInvestigate, re-init baseline