nautechsystems/nautilus_trader · error · anyhow::Error
Unknown IB order status: {value}
Error message
Unknown IB order status: {value} What it means
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.
Source
Thrown at crates/adapters/interactive_brokers/src/common/enums/order.rs:208
)
}
}
impl FromStr for IbOrderStatus {
type Err = anyhow::Error;
fn from_str(value: &str) -> Result<Self, Self::Err> {
match value {
"ApiPending" => Ok(Self::ApiPending),
"PendingSubmit" => Ok(Self::PendingSubmit),
"PreSubmitted" => Ok(Self::PreSubmitted),
"Submitted" => Ok(Self::Submitted),
"PendingCancel" => Ok(Self::PendingCancel),
"ApiCancelled" => Ok(Self::ApiCancelled),
"Cancelled" => Ok(Self::Cancelled),
"Filled" => Ok(Self::Filled),
"Inactive" => Ok(Self::Inactive),
_ => anyhow::bail!("Unknown IB order status: {value}"),
}
}
}
impl Display for IbOrderStatus {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(match self {
Self::ApiPending => "ApiPending",
Self::PendingSubmit => "PendingSubmit",
Self::PreSubmitted => "PreSubmitted",
Self::Submitted => "Submitted",
Self::PendingCancel => "PendingCancel",
Self::ApiCancelled => "ApiCancelled",
Self::Cancelled => "Cancelled",
Self::Filled => "Filled",
Self::Inactive => "Inactive",
})
}View on GitHub (pinned to 18893faf8b)
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.
Example fix
// before let status: IbOrderStatus = "cancelled".parse()?; // exact "Cancelled" required // after let status: IbOrderStatus = ib_order_state.status.clone().parse()?; // raw IB value, e.g. "Cancelled"
Defensive patterns
Strategy: try-catch
Validate before calling
const SUPPORTED_ORDER_STATUSES: &[&str] = &["PendingSubmit","Submitted","PendingCancel","ApiCancelled","Cancelled","Filled","Inactive"];
fn is_known_ib_status(v: &str) -> bool { SUPPORTED_ORDER_STATUSES.contains(&v) } Type guard
fn as_ib_order_status(v: &str) -> Option<IbOrderStatus> {
use std::str::FromStr;
IbOrderStatus::from_str(v).ok()
} Try / catch
match order_state.status.parse::<IbOrderStatus>() {
Ok(s) => apply_status(s),
Err(e) => { log::warn!("unmapped IB order status {:?}: {e}", order_state.status); /* keep order in pending state */ }
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Unknown IB action: {value}
- Unknown IB option right: {value}
- Unknown IB historical tick type: {value}
- Unknown IB order type: {value}
- Unknown IB time in force: {value}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/6ef41f9f63737123.
Report an issue: GitHub.