{"record":{"id":"a4abd3b4bb696b51","repo":"nautechsystems/nautilus_trader","slug":"failed-to-parse-fill-report-for-e","errorCode":null,"errorMessage":"Failed to parse fill report for {}: {e}","messagePattern":"Failed to parse fill report for (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/betfair/src/execution.rs","lineNumber":4249,"sourceCode":"    orders: &[CurrentOrderSummary],\n    fill_tracker: &mut FillTracker,\n    customer_order_refs: &AHashMap<String, CustomerOrderRefResolution>,\n    account_id: AccountId,\n    currency: Currency,\n    ts_init: UnixNanos,\n) -> anyhow::Result<Vec<FillReport>> {\n    let mut reports = Vec::new();\n\n    for order in orders {\n        let size_matched = order.size_matched.unwrap_or(Decimal::ZERO);\n        let size_voided = order.size_voided.unwrap_or(Decimal::ZERO);\n        let gross_matched = size_matched + size_voided;\n        if gross_matched == Decimal::ZERO {\n            continue;\n        }\n\n        parse_betfair_timestamp(&order.placed_date).map_err(|e| {\n            anyhow::anyhow!(\"Failed to parse fill report for {}: {e}\", order.bet_id)\n        })?;\n\n        let has_applied_fill_lots = fill_tracker.has_fill_lots(&order.bet_id);\n        let cumulative = if has_applied_fill_lots {\n            gross_matched\n        } else {\n            size_matched\n        };\n        let incremental_fill = if has_applied_fill_lots && size_voided > Decimal::ZERO {\n            fill_tracker.advance_cumulative_fill_with_voids(\n                &order.bet_id,\n                cumulative,\n                size_voided,\n                order.average_price_matched,\n                order.price_size.price,\n            )\n        } else {\n            fill_tracker.advance_cumulative_fill(","sourceCodeStart":4231,"sourceCodeEnd":4267,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/betfair/src/execution.rs#L4231-L4267","documentation":"While generating fill (execution) reports from listCurrentOrders/cleared orders, the placed_date timestamp on each Betfair order must be parsed by parse_betfair_timestamp. An unparseable timestamp aborts the fill report for that bet_id with this wrapped error.","triggerScenarios":"A Betfair order record has a placed_date string that fails timestamp parsing (wrong format, missing value, unexpected timezone representation) during fill report generation.","commonSituations":"Betfair changing date serialization; null/empty placed_date on unusual order records; locale-dependent date formats.","solutions":["Log the raw placed_date value for the reported bet_id and compare against the expected format.","Extend parse_betfair_timestamp to accept the observed format (e.g. fractional seconds present or absent).","Skip or default the timestamp for records where placed_date is legitimately absent, if business-appropriate."],"exampleFix":"// before\nparse_betfair_timestamp(&order.placed_date).map_err(|e| anyhow::anyhow!(\"Failed to parse fill report for {}: {e}\", order.bet_id))?;\n\n// after\nlet ts = if order.placed_date.is_empty() {\n    ts_init\n} else {\n    parse_betfair_timestamp(&order.placed_date).map_err(|e| anyhow::anyhow!(\"Failed to parse fill report for {}: {e}\", order.bet_id))?\n};","handlingStrategy":"validation","validationCode":"// guard before report generation\nlet ts = parse_betfair_timestamp(&order.placed_date)\n    .inspect_err(|e| tracing::warn!(\"bet {} bad placed_date {:?}: {e}\", order.bet_id, order.placed_date));","typeGuard":null,"tryCatchPattern":"match client.generate_fill_reports().await {\n    Ok(fills) => apply(fills),\n    Err(e) if e.to_string().contains(\"Failed to parse fill report\") => {\n        tracing::error!(\"fill timestamp parse failure: {e:#}\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Verify expected Betfair timestamp format against real payloads after API upgrades.","Make parse_betfair_timestamp tolerant of optional fractional seconds.","Log raw placed_date values on parse failure."],"tags":["fill-reports","timestamp-parsing","betfair"],"backgroundTag":"invalid-date-format","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"}