{"record":{"id":"6ef41f9f63737123","repo":"nautechsystems/nautilus_trader","slug":"unknown-ib-order-status-value","errorCode":null,"errorMessage":"Unknown IB order status: {value}","messagePattern":"Unknown IB order status: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/interactive_brokers/src/common/enums/order.rs","lineNumber":208,"sourceCode":"        )\n    }\n}\n\nimpl FromStr for IbOrderStatus {\n    type Err = anyhow::Error;\n\n    fn from_str(value: &str) -> Result<Self, Self::Err> {\n        match value {\n            \"ApiPending\" => Ok(Self::ApiPending),\n            \"PendingSubmit\" => Ok(Self::PendingSubmit),\n            \"PreSubmitted\" => Ok(Self::PreSubmitted),\n            \"Submitted\" => Ok(Self::Submitted),\n            \"PendingCancel\" => Ok(Self::PendingCancel),\n            \"ApiCancelled\" => Ok(Self::ApiCancelled),\n            \"Cancelled\" => Ok(Self::Cancelled),\n            \"Filled\" => Ok(Self::Filled),\n            \"Inactive\" => Ok(Self::Inactive),\n            _ => anyhow::bail!(\"Unknown IB order status: {value}\"),\n        }\n    }\n}\n\nimpl Display for IbOrderStatus {\n    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n        f.write_str(match self {\n            Self::ApiPending => \"ApiPending\",\n            Self::PendingSubmit => \"PendingSubmit\",\n            Self::PreSubmitted => \"PreSubmitted\",\n            Self::Submitted => \"Submitted\",\n            Self::PendingCancel => \"PendingCancel\",\n            Self::ApiCancelled => \"ApiCancelled\",\n            Self::Cancelled => \"Cancelled\",\n            Self::Filled => \"Filled\",\n            Self::Inactive => \"Inactive\",\n        })\n    }","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/interactive_brokers/src/common/enums/order.rs#L190-L226","documentation":"IbOrderStatus::from_str maps an IB order status string (PendingSubmit, Submitted, PendingCancel, ApiCancelled, Cancelled, Filled, Inactive) into the adapter's enum, matching exact camel-case strings. Any other status bails. It validates statuses from IB order/fill reports before converting them to Nautilus order events.","triggerScenarios":"Parsing an IB OrderState `status` value not in the supported list — e.g. \"Filled\" is handled but statuses like \"Unknown\", \"Cancelled\" with different casing (\"CANCELLED\"), or IB API variants/renamed statuses hit the bail; also direct parse calls with user-provided status strings.","commonSituations":"IB returning a status the adapter version doesn't know (API upgrades occasionally add/alter status strings, e.g. \"PreSubmitted\" variants); storing order statuses in your own persistence layer as lowercase text and re-parsing them; cross-adapter status strings that don't match IB's camel-case names.","solutions":["Pass the status string through unchanged from the IB API — preserve IB's exact camel-case (\"Submitted\", \"ApiCancelled\", etc.).","Inspect the offending value and, if it's a legitimate IB status missing from the match, add it in crates/adapters/interactive_brokers/src/common/enums/order.rs with an appropriate Nautilus mapping.","If the status originates from your own storage/config, normalize it back to IB's exact naming before parsing, or downgrade unknown statuses to a logged no-op instead of failing."],"exampleFix":"// before\nlet status: IbOrderStatus = \"cancelled\".parse()?; // exact \"Cancelled\" required\n// after\nlet status: IbOrderStatus = ib_order_state.status.clone().parse()?; // raw IB value, e.g. \"Cancelled\"","handlingStrategy":"try-catch","validationCode":"const SUPPORTED_ORDER_STATUSES: &[&str] = &[\"PendingSubmit\",\"Submitted\",\"PendingCancel\",\"ApiCancelled\",\"Cancelled\",\"Filled\",\"Inactive\"];\nfn is_known_ib_status(v: &str) -> bool { SUPPORTED_ORDER_STATUSES.contains(&v) }","typeGuard":"fn as_ib_order_status(v: &str) -> Option<IbOrderStatus> {\n    use std::str::FromStr;\n    IbOrderStatus::from_str(v).ok()\n}","tryCatchPattern":"match order_state.status.parse::<IbOrderStatus>() {\n    Ok(s) => apply_status(s),\n    Err(e) => { log::warn!(\"unmapped IB order status {:?}: {e}\", order_state.status); /* keep order in pending state */ }\n}","preventionTips":["Persist and re-parse the raw IB status string verbatim — never lowercase or rewrite it before parsing.","When upgrading the ibapi crate, diff its OrderStatus variants against the adapter's match arms.","Treat unknown statuses as warnings on live trading paths so a stray status string can't stall or crash order management."],"tags":["rust","enum-parsing","interactive-brokers","orders"],"backgroundTag":"invalid-enum-value","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"}