{"record":{"id":"5a06c2319aff3719","repo":"nautechsystems/nautilus_trader","slug":"failure-prefix-outcome-is-unknown-after-possibl","errorCode":null,"errorMessage":"{failure_prefix}; outcome is unknown after possible transmission: {reason}","messagePattern":"(.+?); outcome is unknown after possible transmission: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/interactive_brokers/src/execution/core_orders.rs","lineNumber":575,"sourceCode":"    pub(super) fn handle_order_submit_failure(\n        error: &ibapi::Error,\n        failure_prefix: &str,\n        ib_order_id: i32,\n        account_id: AccountId,\n        ts_event: UnixNanos,\n        order_id_map: &Arc<Mutex<AHashMap<ClientOrderId, i32>>>,\n        venue_order_id_map: &Arc<Mutex<AHashMap<i32, ClientOrderId>>>,\n        instrument_id_map: &Arc<Mutex<AHashMap<i32, InstrumentId>>>,\n        trader_id_map: &Arc<Mutex<AHashMap<i32, TraderId>>>,\n        strategy_id_map: &Arc<Mutex<AHashMap<i32, StrategyId>>>,\n        active_order_contexts: &Arc<Mutex<AHashMap<i32, TrackedOrderContext>>>,\n        terminal_order_contexts: &Arc<Mutex<FifoCacheMap<i32, TrackedOrderContext, 10_000>>>,\n        exec_sender: &tokio::sync::mpsc::UnboundedSender<ExecutionEvent>,\n        clock: &'static AtomicTime,\n    ) -> anyhow::Result<()> {\n        match Self::classify_order_submit_error(error) {\n            CommandFailure::Ambiguous(reason) => {\n                anyhow::bail!(\n                    \"{failure_prefix}; outcome is unknown after possible transmission: {reason}\"\n                );\n            }\n            CommandFailure::NotSent(reason) | CommandFailure::VenueRejected(reason) => {\n                let context = Self::get_tracked_order_context(\n                    ib_order_id,\n                    active_order_contexts,\n                    terminal_order_contexts,\n                )\n                .with_context(|| format!(\"Tracked order context not found for {ib_order_id}\"))?;\n\n                Self::remove_order_tracking(\n                    ib_order_id,\n                    context.client_order_id,\n                    order_id_map,\n                    venue_order_id_map,\n                    instrument_id_map,\n                    trader_id_map,","sourceCodeStart":557,"sourceCodeEnd":593,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/interactive_brokers/src/execution/core_orders.rs#L557-L593","documentation":"When submitting an order to Interactive Brokers fails in a way that makes it impossible to know whether the order actually reached the venue (an 'ambiguous' classification), the adapter aborts with this error rather than fabricating an outcome. The order state is deliberately left unknown so the caller can reconcile with the broker instead of assuming rejected or accepted. It is raised inside handle_order_submit_failure after classify_order_submit_error returns CommandFailure::Ambiguous.","triggerScenarios":"A order submit returns an error that classify_order_submit_error maps to CommandFailure::Ambiguous(reason) — e.g. the request was sent but the response was lost or indeterminate (timeout after send, connection drop mid-request), so transmission may or may not have occurred.","commonSituations":"Network interruptions between the TWS/IB Gateway client and the venue, IB Gateway restarts mid-submit, client timeouts that fire after the request was already written to the socket.","solutions":["Treat the order outcome as unknown: query open orders / executions via reqOpenOrders or reqAllOpenOrders to reconcile the order's actual state before resubmitting.","Use a client order ID / idempotency key so a safe retry does not duplicate the order.","Inspect the failure_prefix and reason logged with the error to identify which transport failure occurred and address the connectivity issue.","Retry the submit only after confirming via the IB API that no matching order is live."],"exampleFix":"// before: blindly resubmitting on any error\nmatch submit_order(order) {\n    Err(e) => { submit_order(order)?; }\n    ...\n}\n// after: reconcile first when the outcome is ambiguous\nmatch submit_order(order) {\n    Err(e) if is_ambiguous_outcome(&e) => {\n        reconcile_order_state(ib_order_id)?; // check open orders/executions\n    }\n    Err(e) => handle_order_submit_failure(...)?,\n    Ok(_) => {}\n}","handlingStrategy":"try-catch","validationCode":"// Before resubmitting, check current open orders via the IB client\nasync fn order_maybe_live(client: &IBClient, ib_order_id: i32) -> bool {\n    client.req_open_orders().await\n        .iter().any(|o| o.order_id == ib_order_id)\n}","typeGuard":null,"tryCatchPattern":"match handle_order_submit_failure(...) {\n    Err(e) if e.to_string().contains(\"outcome is unknown after possible transmission\") => {\n        // do NOT assume rejected; reconcile with broker state first\n        reconcile_order_state(ib_order_id).await?;\n    }\n    Err(e) => return Err(e),\n    Ok(()) => {}\n}","preventionTips":["Maintain idempotent client order IDs so retries are safe","Monitor client/IB Gateway connectivity and fail fast on transport loss","Always reconcile ambiguous submissions against open orders/executions before retrying","Alert on this error rather than auto-resubmitting"],"tags":["order-submission","ambiguity","network","reconciliation"],"backgroundTag":"order-outcome-ambiguous","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"}