{"record":{"id":"5dfcff6d9b8784f4","repo":"nautechsystems/nautilus_trader","slug":"fill-report-start-time-must-not-exceed-end-time-5dfcff","errorCode":null,"errorMessage":"fill report start time must not exceed end time","messagePattern":"fill report start time must not exceed end time","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/spot/execution.rs","lineNumber":1187,"sourceCode":"    ) -> anyhow::Result<Vec<FillReport>> {\n        let Some(instrument_id) = cmd.instrument_id else {\n            log::warn!(\"generate_fill_reports requires instrument_id for Binance Spot\");\n            return Ok(Vec::new());\n        };\n\n        // Convert ClientOrderId to VenueOrderId if provided (API naming quirk)\n        let venue_order_id = cmd\n            .venue_order_id\n            .as_ref()\n            .map(|id| VenueOrderId::new(id.inner()));\n        let requested_start_time = cmd\n            .start\n            .map(|start| start.as_i64() / NANOSECONDS_IN_MILLISECOND as i64);\n        let requested_end_time = cmd\n            .end\n            .map(|end| end.as_i64() / NANOSECONDS_IN_MILLISECOND as i64);\n        if let (Some(start), Some(end)) = (requested_start_time, requested_end_time) {\n            anyhow::ensure!(\n                start <= end,\n                \"fill report start time must not exceed end time\"\n            );\n        }\n\n        let mut reports = Vec::new();\n        let mut seen_trade_ids = AHashSet::new();\n\n        if venue_order_id.is_some() {\n            let mut from_id = 0;\n\n            loop {\n                let page = self\n                    .http_client\n                    .request_fill_reports_with_cursor(\n                        self.core.account_id,\n                        instrument_id,\n                        venue_order_id,","sourceCodeStart":1169,"sourceCodeEnd":1205,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/binance/src/spot/execution.rs#L1169-L1205","documentation":"GenerateFillReports converts the command's start/end (nanoseconds) to milliseconds and validates the window: if both are provided, start must not exceed end. This guards the Binance myTrades queries so an inverted window is rejected before any request is made.","triggerScenarios":"Requesting fill reports (mass status or a direct GenerateFillReports command) with a start timestamp later than the end timestamp — e.g. swapped arguments, or a start in the future relative to a fixed end.","commonSituations":"Manually built report commands with swapped start/end; timezone or unit confusion (passing seconds where ms are expected then converting); scripted backfills with templated dates.","solutions":["Order the window: pass the earlier time as start and the later time as end","Omit end so it defaults to the current clock time","Double-check timestamp units (Nautilus uses unix nanoseconds; the adapter converts to Binance ms)"],"exampleFix":"// before\nlet cmd = GenerateFillReportsBuilder::default()\n    .start(end_ts)  // swapped\n    .end(start_ts)\n    .build()?;\n\n// after\nlet cmd = GenerateFillReportsBuilder::default()\n    .start(start_ts)\n    .end(end_ts)\n    .build()?;","handlingStrategy":"validation","validationCode":"fn normalize_window(start_ms: i64, end_ms: i64) -> anyhow::Result<(i64, i64)> {\n    anyhow::ensure!(start_ms <= end_ms, \"start {start_ms}ms after end {end_ms}ms\");\n    Ok((start_ms, end_ms))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Build report windows from a single (start, duration) pair instead of two independent timestamps","Assert timestamp units at the boundary (ns in Nautilus, ms at Binance)","For scripted scans, derive end from the clock rather than a hardcoded value"],"tags":["binance","spot","fill-reports","time-range","validation"],"backgroundTag":"invalid-time-range","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}