{"record":{"id":"cfae20fed2822862","repo":"nautechsystems/nautilus_trader","slug":"failed-to-fetch-products-e-cfae20","errorCode":null,"errorMessage":"Failed to fetch products: {e}","messagePattern":"Failed to fetch products: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/coinbase/src/provider.rs","lineNumber":80,"sourceCode":"    }\n\n    /// Returns a cached instrument by ID, if present.\n    #[must_use]\n    pub fn get(&self, instrument_id: &InstrumentId) -> Option<InstrumentAny> {\n        self.client.instruments().get_cloned(instrument_id)\n    }\n\n    /// Loads all instruments from the Coinbase REST API and caches them.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the HTTP request fails or the response cannot be parsed.\n    pub async fn load_all(&self) -> anyhow::Result<Vec<InstrumentAny>> {\n        let json = self\n            .client\n            .get_products()\n            .await\n            .map_err(|e| anyhow::anyhow!(\"Failed to fetch products: {e}\"))?;\n\n        self.load_from_products_response(&json)\n    }\n\n    /// Loads all instruments of a specific product type from the REST API.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the HTTP request fails or the response cannot be parsed.\n    pub async fn load_all_filtered(\n        &self,\n        product_type: CoinbaseProductType,\n    ) -> anyhow::Result<Vec<InstrumentAny>> {\n        let json = self\n            .client\n            .get_products()\n            .await\n            .map_err(|e| anyhow::anyhow!(\"Failed to fetch products: {e}\"))?;","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/coinbase/src/provider.rs#L62-L98","documentation":"CoinbaseInstrumentProvider::load_all fetches the full products list via the HTTP client's get_products endpoint. Any transport-level failure — network error, DNS failure, TLS problem, timeout, non-success HTTP status surfaced as a client error — is wrapped into this anyhow error. It means the request itself failed before any parsing happened.","triggerScenarios":"Calling load_all() when the Coinbase REST endpoint is unreachable, the API returns 4xx/5xx, rate limits are hit, TLS/timeouts occur, or no network is available.","commonSituations":"Running without internet or behind a corporate proxy; missing/invalid Coinbase API credentials causing 401; hitting the public rate limit (429); Coinbase incident/outage; wrong base URL in client configuration.","solutions":["Inspect the wrapped source error ({e}) to see the exact HTTP/network cause.","Verify network connectivity, proxy settings, and that the Coinbase API base URL is reachable (curl the products endpoint).","Check API key/secret configuration if the endpoint requires authentication.","Add retry with backoff for transient failures (429/5xx/timeouts)."],"exampleFix":"// before\nlet instruments = provider.load_all().await?;\n// after\nlet instruments = match provider.load_all().await {\n    Ok(i) => i,\n    Err(e) => {\n        tracing::error!(\"products fetch failed: {e:#}\");\n        if e.to_string().contains(\"429\") {\n            tokio::time::sleep(Duration::from_secs(5)).await;\n            provider.load_all().await?\n        } else {\n            return Err(e);\n        }\n    }\n};","handlingStrategy":"retry","validationCode":"async fn products_reachable(base: &str) -> bool {\n    reqwest::get(format!(\"{base}/products\")).await.map(|r| r.status().is_success()).unwrap_or(false)\n}\nassert!(products_reachable(\"https://api.coinbase.com\").await, \"Coinbase API unreachable\");","typeGuard":null,"tryCatchPattern":"match provider.load_all().await {\n    Ok(instruments) => instruments,\n    Err(e) => {\n        warn!(\"products fetch failed: {e:#}\");\n        backoff_retry(|| provider.load_all(), 3).await?\n    }\n}","preventionTips":["Implement exponential backoff for 429/5xx/timeouts.","Check network/proxy/credentials before starting the provider.","Monitor Coinbase status for outages; fail fast on 401 rather than retrying."],"tags":["http","network","coinbase","instrument-provider"],"backgroundTag":"http-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"}