{"record":{"id":"1396f0b56bb25f23","repo":"nautechsystems/nautilus_trader","slug":"failed-to-fetch-cfm-position-product-id-e","errorCode":null,"errorMessage":"Failed to fetch CFM position '{product_id}': {e}","messagePattern":"Failed to fetch CFM position '(.+?)': (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/coinbase/src/http/client.rs","lineNumber":1525,"sourceCode":"\n    /// Fetches a single CFM futures position and returns a position status\n    /// report when the venue reports a non-flat position.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error when the HTTP request fails or the position cannot be\n    /// parsed.\n    pub async fn request_position_status_report(\n        &self,\n        account_id: AccountId,\n        instrument_id: InstrumentId,\n    ) -> anyhow::Result<Option<PositionStatusReport>> {\n        let product_id = instrument_id.symbol.as_str();\n        let response = self\n            .inner\n            .get_cfm_position(product_id)\n            .await\n            .map_err(|e| anyhow::anyhow!(\"Failed to fetch CFM position '{product_id}': {e}\"))?;\n\n        let instrument = self\n            .get_or_fetch_instrument(response.position.product_id)\n            .await?;\n        let ts_init = self.ts_now();\n        let report =\n            parse_cfm_position_status_report(&response.position, &instrument, account_id, ts_init)?;\n        Ok(Some(report))\n    }\n\n    /// Modifies an existing GTC order's price, size, or stop price.\n    ///\n    /// Coinbase's `/orders/edit` endpoint is documented to accept edits on\n    /// these fields for supported order configurations (primarily LIMIT\n    /// GTC). At least one of `price`, `quantity`, or `trigger_price` must\n    /// be supplied.\n    ///\n    /// # Errors","sourceCodeStart":1507,"sourceCodeEnd":1543,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/coinbase/src/http/client.rs#L1507-L1543","documentation":"This error wraps a failure from the single-position Coinbase `get_cfm_position(product_id)` call, made when resolving the position status for one CFM instrument; the message includes the product_id queried. It means the per-product futures position lookup failed — unknown product, missing futures entitlement, auth, network, or API error.","triggerScenarios":"Calling the single CFM position report method with an `instrument_id` whose symbol maps to a product_id not found on CFM (e.g. a spot symbol passed to the futures endpoint), or when the HTTP request fails due to auth/network/rate limits.","commonSituations":"Querying a spot instrument id through the CFM position API by mistake; instrument symbols not matching Coinbase futures product naming (e.g. BTC-PERP-INTX); account not enabled for futures; transient network failures.","solutions":["Verify the instrument_id symbol matches a valid Coinbase futures product id.","Confirm you are not querying a spot instrument via the CFM endpoint.","Check futures entitlement and API key scopes for the account.","Retry transient errors with backoff.","Log the product_id and inner error to distinguish not-found from auth/network failures."],"exampleFix":"// before: any CFM lookup failure is fatal\nlet report = client.request_cfm_position_status_report(instrument_id, account_id).await?;\n// after: tolerate missing position (flat)\nlet report = match client.request_cfm_position_status_report(instrument_id, account_id).await {\n    Ok(r) => r,\n    Err(e) if is_not_found(&e) => None,\n    Err(e) => return Err(e),\n};","handlingStrategy":"validation","validationCode":"let product_id = instrument_id.symbol.as_str();\nif !is_cfm_product(product_id) {\n    anyhow::bail!(\"{product_id} is not a CFM futures product\");\n}","typeGuard":null,"tryCatchPattern":"match client.request_cfm_position_status_report(instrument_id, account_id).await {\n    Ok(report) => report,\n    Err(e) if is_retryable(&e) => retry_with_backoff(3, Duration::from_secs(1), || {\n        client.request_cfm_position_status_report(instrument_id, account_id)\n    }).await?,\n    Err(e) => { tracing::error!(\"CFM position '{product}' lookup failed: {e}\"); return Err(e); }\n}","preventionTips":["Map Nautilus instrument ids to CFM product ids via a validated registry.","Only invoke CFM position lookups for known futures instruments.","Check entitlements once at startup rather than per-call.","Include the product_id in all CFM error logs."],"tags":["network","http","coinbase","futures","cfm"],"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"}