{"record":{"id":"c507474ad6f96ebc","repo":"nautechsystems/nautilus_trader","slug":"reconnection-timeout-after-timeout-mins-minutes","errorCode":null,"errorMessage":"Reconnection timeout after {timeout_mins} minutes: {e}","messagePattern":"Reconnection timeout after (.+?) minutes: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"critical","filePath":"crates/adapters/databento/src/live.rs","lineNumber":499,"sourceCode":"                        log::info!(\"Resetting reconnection cycle after successful session\");\n                        reconnect_start = None;\n                        attempt = 0;\n                        self.backoff.reset();\n                    } else {\n                        log::debug!(\"Session ended normally\");\n                        break Ok(());\n                    }\n                }\n                Err(e) => {\n                    let cycle_start = reconnect_start.get_or_insert_with(tokio::time::Instant::now);\n\n                    if let Some(timeout_mins) = self.reconnect_timeout_mins {\n                        let elapsed = cycle_start.elapsed();\n                        let timeout = Duration::from_mins(timeout_mins);\n\n                        if elapsed >= timeout {\n                            log::error!(\"Giving up reconnection after {timeout_mins} minutes\");\n                            self.send_msg(DatabentoMessage::Error(anyhow::anyhow!(\n                                \"Reconnection timeout after {timeout_mins} minutes: {e}\"\n                            )));\n                            break Err(e);\n                        }\n                    }\n\n                    let delay = self.backoff.next_duration();\n\n                    log::warn!(\n                        \"Connection lost (attempt {}): {}. Reconnecting in {}s...\",\n                        attempt,\n                        e,\n                        delay.as_secs()\n                    );\n\n                    let sleep = tokio::time::sleep(delay);\n                    tokio::pin!(sleep);\n","sourceCodeStart":481,"sourceCodeEnd":517,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/databento/src/live.rs#L481-L517","documentation":"During live-feed reconnection, `run` tracks how long consecutive failed reconnect cycles have lasted. If `reconnect_timeout_mins` is configured and the elapsed time since `cycle_start` exceeds that budget, it emits an `Error` message with this text and breaks out with the last underlying error `e`. It prevents the client from retrying a dead connection indefinitely.","triggerScenarios":"The Databento live gateway is unreachable (network outage, invalid credentials causing immediate rejections, dataset/ gateway problems) so every reconnect cycle fails continuously for longer than `reconnect_timeout_mins` minutes.","commonSituations":"Network/firewall blocking `databento.com` live endpoints; expired API key causing endless auth rejections; Databento maintenance windows exceeding the timeout; a too-small `reconnect_timeout_mins` giving up during a transient outage.","solutions":["Fix the underlying cause reported in the inner error `e` (connectivity, credentials, dataset)","Verify network access to Databento's live gateway and that the API key is valid","Increase `reconnect_timeout_mins` if transient outages legitimately last longer than the budget","Implement an outer supervisor that rebuilds and restarts the feed client after this terminal error","Alert/monitor on the emitted `DatabentoMessage::Error` so operators react before data loss grows"],"exampleFix":"// before\nlet client = DatabentoLiveClient::builder()\n    .reconnect_timeout_mins(5)\n    .build()?;\n\n// after\nlet client = DatabentoLiveClient::builder()\n    .reconnect_timeout_mins(30) // tolerate longer outages\n    .build()?;","handlingStrategy":"retry","validationCode":"// before running: probe connectivity/credentials\nlet client = HttpClient::new();\nclient.get(\"https://hist.databento.com/v0/\").await?; // fail fast if unreachable","typeGuard":null,"tryCatchPattern":"match feed.run().await {\n    Err(e) if e.to_string().contains(\"Reconnection timeout\") => {\n        log::error!(\"live feed gave up reconnecting: {e:#}\");\n        // page operator, then rebuild client and restart after backoff\n    }\n    other => other?,\n}","preventionTips":["Monitor the DatabentoMessage::Error channel so timeouts alert operators","Size reconnect_timeout_mins above plausible transient outage lengths","Validate API credentials at startup to avoid endless auth-failure loops","Run an outer supervisor that restarts the feed with fresh state"],"tags":["rust","databento","live-streaming","reconnect","timeout","network"],"backgroundTag":"request-timeout","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"}