{"record":{"id":"7d1d1759f8d5c928","repo":"nautechsystems/nautilus_trader","slug":"failed-to-fetch-order-e","errorCode":null,"errorMessage":"Failed to fetch order: {e}","messagePattern":"Failed to fetch order: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/coinbase/src/http/client.rs","lineNumber":1175,"sourceCode":"                    .map_err(|e| anyhow::anyhow!(\"Failed to fetch orders: {e}\"))?;\n                let order = orders\n                    .into_iter()\n                    .next()\n                    .ok_or_else(|| anyhow::anyhow!(\"No order found for client_order_id={cid}\"))?;\n                let instrument = self.get_or_fetch_instrument(order.product_id).await?;\n                let ts_init = self.ts_now();\n                return parse_order_status_report(&order, &instrument, account_id, ts_init);\n            }\n            (None, None) => {\n                anyhow::bail!(\"Either client_order_id or venue_order_id is required\")\n            }\n        };\n\n        let json = self\n            .inner\n            .get_order(venue_order_id.as_str())\n            .await\n            .map_err(|e| anyhow::anyhow!(\"Failed to fetch order: {e}\"))?;\n        let response: OrderResponse =\n            serde_json::from_value(json).map_err(|e| anyhow::anyhow!(e))?;\n        let instrument = self\n            .get_or_fetch_instrument(response.order.product_id)\n            .await?;\n        let ts_init = self.ts_now();\n        parse_order_status_report(&response.order, &instrument, account_id, ts_init)\n    }\n\n    /// Requests order status reports, optionally filtered by instrument, open\n    /// status, and time window.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error when the HTTP request fails or when any response cannot\n    /// be deserialized.\n    pub async fn request_order_status_reports(\n        &self,","sourceCodeStart":1157,"sourceCodeEnd":1193,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/coinbase/src/http/client.rs#L1157-L1193","documentation":"This error wraps any failure from the Coinbase Advanced Trade HTTP `get_order` call made while building an `OrderStatusReport` in `request_order_status_report`. It means the adapter could not retrieve the order from the exchange — the underlying anyhow error (network failure, HTTP error status, auth problem, or API error payload) is formatted into the message. It is thrown because order status reconciliation cannot proceed without the raw order JSON.","triggerScenarios":"Calling `request_order_status_report` (e.g. via `resolve_order_context` during reconciliation) with a `venue_order_id` whose `get_order` HTTP request fails: network drop, 401/403 auth, 404 unknown order id, 429 rate limit, or any non-success Coinbase response.","commonSituations":"Reconciliation at startup against a stale/foreign venue_order_id; expired or misconfigured Coinbase API keys; sandbox vs production endpoint mismatch; transient network outage or hitting Coinbase rate limits during mass reconciliation.","solutions":["Check the inner error in the message for the root cause (HTTP status, auth, timeout).","Verify COINBASE API key/secret/passphrase are valid and have the right scope for Advanced Trade.","Confirm the venue_order_id actually exists on the connected Coinbase account and environment (prod vs sandbox).","Retry on transient errors (5xx/timeout/429) with backoff before failing reconciliation.","If only a client_order_id is known, call with client_order_id so the batched list endpoint is used instead."],"exampleFix":"// before: reconciliation fails hard on transient get_order errors\nlet report = client.request_order_status_report(account_id, None, Some(venue_order_id)).await?;\n// after: retry transient failures\nlet report = match client.request_order_status_report(account_id, None, Some(venue_order_id)).await {\n    Ok(r) => r,\n    Err(e) if is_transient(&e) => {\n        tokio::time::sleep(Duration::from_millis(500)).await;\n        client.request_order_status_report(account_id, None, Some(venue_order_id)).await?\n    }\n    Err(e) => return Err(e),\n};","handlingStrategy":"retry","validationCode":"if venue_order_id.is_none() && client_order_id.is_none() {\n    anyhow::bail!(\"Either client_order_id or venue_order_id is required\");\n}\n// only query venue_order_ids previously issued by this adapter","typeGuard":null,"tryCatchPattern":"match client.request_order_status_report(account_id, None, Some(vid)).await {\n    Ok(report) => report,\n    Err(e) if is_retryable(&e) => retry_with_backoff(3, Duration::from_millis(500), || {\n        client.request_order_status_report(account_id, None, Some(vid))\n    }).await?,\n    Err(e) => { tracing::error!(\"order fetch failed: {e}\"); return Err(e); }\n}","preventionTips":["Only query venue_order_ids previously issued by this adapter.","Validate credentials before bulk reconciliation sweeps.","Use client_order_id lookups when the venue id is unknown.","Apply backoff for rate-limited reconciliation.","Log the full anyhow error chain, not just the wrapper message."],"tags":["network","http","coinbase","reconciliation"],"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-14T05:17:10.506Z"}