{"record":{"id":"d5bb793774335102","repo":"nautechsystems/nautilus_trader","slug":"unsupported-okx-order-status-e","errorCode":null,"errorMessage":"Unsupported OKX order status: {e}","messagePattern":"Unsupported OKX order status: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/okx/src/common/parse.rs","lineNumber":838,"sourceCode":"        (quantity_dec, filled_qty_dec)\n    };\n\n    // For quote-quantity orders marked as FILLED, adjust quantity to match filled_qty\n    // to avoid precision mismatches from quote-to-base conversion\n    let (quantity, filled_qty) = if (is_quote_qty_explicit || is_quote_qty_heuristic)\n        && order.state == OKXOrderStatus::Filled\n        && filled_qty.is_positive()\n    {\n        (filled_qty, filled_qty)\n    } else {\n        (quantity, filled_qty)\n    };\n\n    let order_side = OrderSide::from(order.side);\n    let order_status: OrderStatus = order\n        .state\n        .try_into()\n        .map_err(|e| anyhow::anyhow!(\"Unsupported OKX order status: {e}\"))?;\n    let time_in_force = match okx_ord_type {\n        OKXOrderType::Fok | OKXOrderType::OpFok => TimeInForce::Fok,\n        OKXOrderType::Ioc | OKXOrderType::OptimalLimitIoc => TimeInForce::Ioc,\n        _ => TimeInForce::Gtc,\n    };\n\n    let client_order_id = parse_parent_client_order_id(\n        order.algo_cl_ord_id.as_ref().map(Ustr::as_str),\n        order.cl_ord_id.as_str(),\n    );\n    let mut linked_ids = Vec::new();\n\n    if let Some(attach_algo_cl_ord_id) = order\n        .attach_algo_cl_ord_id\n        .as_ref()\n        .filter(|value| !value.as_str().is_empty())\n    {\n        let attach_client_id = ClientOrderId::new(attach_algo_cl_ord_id.as_str());","sourceCodeStart":820,"sourceCodeEnd":856,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/okx/src/common/parse.rs#L820-L856","documentation":"parse_order_status_report converts the OKX order state string via TryInto<OrderStatus>. This error is raised when the state value received from OKX has no mapping to a Nautilus OrderStatus, meaning the adapter encountered an unrecognized or newly introduced OKX order state.","triggerScenarios":"order.state is a value outside the mapped set (e.g. a new OKX status like a novel state string added by OKX, or a corrupted/unexpected value in the payload) passed through TryInto<OrderStatus>.","commonSituations":"OKX introducing new order states not yet supported by the installed adapter version; typo'd or synthetic state values in test fixtures/mocks; proxy layers rewriting payloads; using an outdated adapter against the current OKX API.","solutions":["Log order.state and ord_id to capture the unrecognized value","Upgrade the nautilus-adapters/OKX crate to a version supporting the new OKX state","Patch the OKXOrderStatus->OrderStatus TryFrom impl to map or gracefully ignore the new state","Check for middleware or recorded fixtures injecting non-standard state strings"],"exampleFix":"// before\nlet status: OrderStatus = order.state.try_into().map_err(|e| anyhow!(\"Unsupported OKX order status: {e}\"))?;\n// after\nlet status = match OrderStatus::try_from(order.state) {\n    Ok(s) => s,\n    Err(e) => { log::warn!(\"Skipping order {} with unknown state '{}': {e}\", order.ord_id, order.state); return Ok(None); }\n};","handlingStrategy":"try-catch","validationCode":"fn is_supported_state(state: OKXOrderStatus) -> bool {\n    matches!(state, OKXOrderStatus::Live | OKXOrderStatus::PartiallyFilled | OKXOrderStatus::Filled | OKXOrderStatus::Canceled)\n} // adjust to the exact mapped set in your adapter version","typeGuard":"fn to_order_status(state: OKXOrderStatus) -> Option<OrderStatus> { OrderStatus::try_from(state).ok() }","tryCatchPattern":"match parse_order_status_report(&order, &instrument, ts_init) {\n    Ok(r) => handle(r),\n    Err(e) if e.to_string().contains(\"Unsupported OKX order status\") => { log::warn!(\"unknown state '{}' for {}: {e}\", order.state, order.ord_id); Ok(None) }\n    Err(e) => Err(e),\n}","preventionTips":["Subscribe to OKX API changelogs for new order states","Upgrade the adapter when OKX introduces new statuses","Never fabricate state values in fixtures/mocks","Handle unknown states by skipping and logging, not crashing the stream"],"tags":["okx","rust","enum","order-status","parsing"],"backgroundTag":"unsupported-enum-value","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}