{"record":{"id":"3a49c239f92b1063","repo":"nautechsystems/nautilus_trader","slug":"skipping-execution-without-order-id","errorCode":null,"errorMessage":"Skipping execution without order_id: {:?}","messagePattern":"Skipping execution without order_id: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/adapters/bitmex/src/http/parse.rs","lineNumber":1094,"sourceCode":"/// Parse a BitMEX execution into a Nautilus `FillReport` using instrument scaling.\n///\n/// # Errors\n///\n/// Returns an error when the execution does not represent a trade or lacks required identifiers.\npub fn parse_fill_report(\n    exec: &BitmexExecution,\n    instrument: &InstrumentAny,\n    ts_init: UnixNanos,\n) -> anyhow::Result<FillReport> {\n    // Skip non-trade executions (funding, settlements, etc.)\n    // Trade executions have exec_type of Trade and must have order_id\n    if !matches!(exec.exec_type, BitmexExecType::Trade) {\n        anyhow::bail!(\"Skipping non-trade execution: {:?}\", exec.exec_type);\n    }\n\n    // Additional check: skip executions without order_id (likely funding/settlement)\n    let order_id = exec.order_id.ok_or_else(|| {\n        anyhow::anyhow!(\"Skipping execution without order_id: {:?}\", exec.exec_type)\n    })?;\n\n    let account_id = bitmex_account_id(exec.account);\n    let instrument_id = instrument.id();\n    let venue_order_id = VenueOrderId::new(order_id.to_string());\n    // trd_match_id might be missing for some execution types, use exec_id as fallback\n    let trade_id = TradeId::new(\n        exec.trd_match_id\n            .or(Some(exec.exec_id))\n            .ok_or_else(|| anyhow::anyhow!(\"Fill missing both trd_match_id and exec_id\"))?\n            .to_string(),\n    );\n    // Skip executions without side (likely not trades)\n    let Some(side) = exec.side else {\n        anyhow::bail!(\"Skipping execution without side: {:?}\", exec.exec_type);\n    };\n    let order_side = OrderSide::from(side);\n    let last_qty = parse_signed_contracts_quantity(exec.last_qty, instrument);","sourceCodeStart":1076,"sourceCodeEnd":1112,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/bitmex/src/http/parse.rs#L1076-L1112","documentation":"parse_fill_report skips BitMEX executions that have no `order_id`. Such executions are not order fills (funding, settlement, etc. carry no order reference). The library surfaces this as an anyhow error so the caller (request_fill_reports) can catch and skip the record.","triggerScenarios":"request_fill_reports iterating the /execution response when an entry has exec_type Trade but order_id null — e.g. funding or settlement records mis-typed, or execution rows for manually-liquidated positions.","commonSituations":"Downloading full fill history for an account that includes funding payments; ADL/liquidation rows without a parent order; BitMEX returning non-order executions in the execution feed.","solutions":["Treat this as an expected skip: catch the error in request_fill_reports and continue to the next execution.","Filter the execution list to entries with a non-null order_id before parsing.","Restrict the request to order-scoped execution endpoints when only fills are needed.","Inspect exec_type/exec_id of the offending record to confirm it is funding/settlement."],"exampleFix":"// before\nlet report = parse_fill_report(exec, instrument)?;\n// after\nfor exec in executions {\n    match parse_fill_report(exec, instrument) {\n        Ok(r) => reports.push(r),\n        Err(e) if e.to_string().contains(\"Skipping\") => continue,\n        Err(e) => return Err(e),\n    }\n}","handlingStrategy":"try-catch","validationCode":"let fillable: Vec<_> = executions.into_iter().filter(|e| e.order_id.is_some()).collect();","typeGuard":"fn is_order_fill(exec: &BitmexExecution) -> bool {\n    exec.order_id.is_some() && matches!(exec.exec_type, BitmexExecType::Trade)\n}","tryCatchPattern":"match parse_fill_report(exec, instrument) {\n    Ok(r) => reports.push(r),\n    Err(e) if e.to_string().starts_with(\"Skipping\") => continue,\n    Err(e) => return Err(e),\n}","preventionTips":["Expect non-order executions (funding, settlement, liquidations) in execution history.","Filter by exec_type == Trade and order_id presence before parsing.","Log skipped executions for audit rather than failing the whole request."],"tags":["bitmex","fills","skipped-record","null-field"],"backgroundTag":"missing-required-argument","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"}