{"record":{"id":"9da6c99cb520c86c","repo":"nautechsystems/nautilus_trader","slug":"failed-to-preview-aggressive-limit-order-e","errorCode":null,"errorMessage":"Failed to preview aggressive limit order: {e}","messagePattern":"Failed to preview aggressive limit order: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/architect_ax/src/execution.rs","lineNumber":265,"sourceCode":"                == OrderType::Market\n            {\n                let preview_result: anyhow::Result<Price> = async {\n                    let symbol = instrument_id.symbol.inner();\n                    let ax_side = AxOrderSide::from(order_side);\n                    let qty_contracts = quantity_to_contracts(quantity)?;\n\n                    let instrument = http_client.get_instrument(&symbol).ok_or_else(|| {\n                        anyhow::anyhow!(\"Instrument {instrument_id} not found in cache\")\n                    })?;\n\n                    let request =\n                        PreviewAggressiveLimitOrderRequest::new(symbol, qty_contracts, ax_side);\n                    let response = http_client\n                        .inner\n                        .preview_aggressive_limit_order(&request)\n                        .await\n                        .map_err(|e| {\n                            anyhow::anyhow!(\"Failed to preview aggressive limit order: {e}\")\n                        })?;\n\n                    if response.remaining_quantity > 0 {\n                        log::warn!(\n                            \"Market order book depth insufficient: \\\n                             filled_qty={} remaining_qty={} for {instrument_id}\",\n                            response.filled_quantity,\n                            response.remaining_quantity,\n                        );\n                    }\n\n                    let limit_price_decimal = response.limit_price.ok_or_else(|| {\n                        anyhow::anyhow!(\n                            \"No liquidity available for market order on {instrument_id}\"\n                        )\n                    })?;\n\n                    let price =","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/architect_ax/src/execution.rs#L247-L283","documentation":"Raised in `submit_order_internal` when the HTTP call `preview_aggressive_limit_order` fails while converting a market order into a priced aggressive limit order. The adapter previews the order against AX to obtain a limit price and fill estimate; any transport or API error in that preview is wrapped with this message.","triggerScenarios":"Submitting a MARKET order on AX when the preview HTTP request fails: network error, HTTP error response from AX, auth/token expired for the HTTP API, or invalid preview request parameters (symbol, contracts quantity, side).","commonSituations":"AX API outage or 5xx during order submission; expired HTTP auth token; quantity converted to contracts below the instrument's minimum; network partition to the AX REST endpoint; malformed request due to unexpected quantity precision.","solutions":["Inspect the wrapped inner error to determine whether it is network, HTTP status, or auth related.","Verify HTTP credentials/token validity and re-authenticate if expired.","Check the quantity converts to a valid contracts amount for the instrument (min size, precision).","Confirm AX REST endpoint reachability and service status.","Retry the submission if the failure was transient (timeout, 5xx)."],"exampleFix":"// before\nlet response = http_client.inner.preview_aggressive_limit_order(&request).await?;\n// after\nmatch http_client.inner.preview_aggressive_limit_order(&request).await {\n    Ok(resp) => resp,\n    Err(e) if e.is_timeout() || e.status().map_or(false, |s| s.is_server_error()) => {\n        // retry once with backoff\n        tokio::time::sleep(Duration::from_millis(250)).await;\n        http_client.inner.preview_aggressive_limit_order(&request).await?\n    }\n    Err(e) => return Err(e.into()),\n}","handlingStrategy":"retry","validationCode":"if quantity.as_decimal() < instrument.min_quantity().unwrap().as_decimal() {\n    anyhow::bail!(\"quantity {quantity} below AX minimum for {instrument_id}\");\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"Failed to preview aggressive limit order\") => {\n        // inspect cause: network -> retry, auth -> re-auth, 4xx -> fail fast\n        log::error!(\"preview failed: {e:#}\");\n    }\n    other => other?,\n}","preventionTips":["Pre-validate quantity against instrument min size and precision before market orders.","Ensure HTTP auth tokens are refreshed proactively, not lazily.","Add client-side timeouts so preview failures surface quickly and can be retried.","Monitor AX API status and back off during outages."],"tags":["http","orders","preview","api"],"backgroundTag":"api-request-failed","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}