{"record":{"id":"f634919fd759e50b","repo":"nautechsystems/nautilus_trader","slug":"fill-report-start-time-must-not-exceed-end-time","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/futures/execution.rs","lineNumber":2462,"sourceCode":"                    \"Dropping historical Binance Futures fills for unresolved instrument {instrument_id}\"\n                );\n            }\n            return Ok(Vec::new());\n        };\n\n        let symbol = format_binance_symbol(&instrument_id);\n        let mut trades = Vec::new();\n        let mut seen_trade_ids = AHashSet::new();\n        let requested_end_time = cmd\n            .end\n            .map(|end| end.as_i64() / NANOSECONDS_IN_MILLISECOND as i64);\n\n        if let Some(start) = cmd.start {\n            let query_start_time = start.as_i64() / NANOSECONDS_IN_MILLISECOND as i64;\n            let query_end_time = requested_end_time.unwrap_or_else(|| {\n                self.clock.get_time_ns().as_i64() / NANOSECONDS_IN_MILLISECOND as i64\n            });\n            anyhow::ensure!(\n                query_start_time <= query_end_time,\n                \"fill report start time must not exceed end time\"\n            );\n            let complete_start = user_trades_complete_start(cmd.ts_init, self.clock.get_time_ns());\n            anyhow::ensure!(\n                start >= complete_start,\n                \"Binance Futures fill report range is incomplete: start {start} precedes complete-history boundary {complete_start}\"\n            );\n            let mut window_start = query_start_time;\n\n            loop {\n                let window_end = window_start\n                    .saturating_add(USER_TRADES_MAX_INTERVAL_MS)\n                    .min(query_end_time);\n                let mut from_id = None;\n\n                loop {\n                    let mut builder = BinanceUserTradesParamsBuilder::default();","sourceCodeStart":2444,"sourceCodeEnd":2480,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/futures/execution.rs#L2444-L2480","documentation":"Raised in generate_fill_reports when the requested fill-report query window is inverted: the command's start time (converted to milliseconds) is greater than the end time (either the provided end or 'now'). NautilusTrader validates the window before querying user trades so it never issues a guaranteed-empty/invalid Binance userTrades request.","triggerScenarios":"Calling generate_mass_status (or the fill report path) with cmd.start later than cmd.end, or with a start time in the future relative to the node clock so that start_ms > now_ms when no explicit end is given.","commonSituations":"A user passes reversed start/end dates to a mass status request; clock skew makes the node's 'now' earlier than the requested start; timezone/date parsing errors in tooling that builds the command.","solutions":["Ensure cmd.start <= cmd.end (or <= current time when end is omitted) in the mass status request.","Swap or correct the start/end arguments if they were reversed.","Synchronize the machine clock (NTP) if the start time appears valid but is after the node's now.","Validate the timestamp range in the calling tool/script before issuing the request."],"exampleFix":"// before\nlet cmd = GenerateFillReports::new(None, start_ms, end_ms); // start_ms > end_ms\n\n// after\nassert!(start_ms <= end_ms, \"start must not exceed end\");\nlet cmd = GenerateFillReports::new(None, start_ms, end_ms);","handlingStrategy":"validation","validationCode":"let now_ms = clock.get_time_ns().as_i64() / 1_000_000;\nlet start_ms = start.as_i64() / 1_000_000;\nlet end_ms = end.map(|e| e.as_i64() / 1_000_000).unwrap_or(now_ms);\nif start_ms > end_ms {\n    return Err(\"fill report start must not exceed end\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check start <= end before issuing mass status requests","Synchronize clocks via NTP to avoid now < start","Validate user-supplied dates in tooling that builds commands"],"tags":["binance","fill-reports","time-window","validation"],"backgroundTag":"invalid-query-parameter","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}