{"record":{"id":"a21648da299c4bdc","repo":"nautechsystems/nautilus_trader","slug":"timeout-must-be-less-than-3600-seconds","errorCode":null,"errorMessage":"Timeout must be less than 3600 seconds","messagePattern":"Timeout must be less than 3600 seconds","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/interactive_brokers/src/config.rs","lineNumber":364,"sourceCode":"                &value[0..1],\n                \"*\".repeat(value.len() - 2),\n                &value[value.len() - 1..]\n            )\n        }\n    }\n\n    /// Validate configuration.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if validation fails.\n    pub fn validate(&self) -> anyhow::Result<()> {\n        if self.timeout == 0 {\n            anyhow::bail!(\"Timeout must be greater than 0\");\n        }\n\n        if self.timeout > 3600 {\n            anyhow::bail!(\"Timeout must be less than 3600 seconds\");\n        }\n\n        if let Some(port) = self.vnc_port\n            && (!(5900..=5999).contains(&port))\n        {\n            anyhow::bail!(\"VNC port must be between 5900 and 5999\");\n        }\n\n        Ok(())\n    }\n}\n\nimpl Default for DockerizedIBGatewayConfig {\n    fn default() -> Self {\n        Self::builder()\n            .maybe_username(std::env::var(\"TWS_USERNAME\").ok().map(SecretString::from))\n            .maybe_password(std::env::var(\"TWS_PASSWORD\").ok().map(SecretString::from))\n            .build()","sourceCodeStart":346,"sourceCodeEnd":382,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/interactive_brokers/src/config.rs#L346-L382","documentation":"Config validation in the InteractiveBrokers client configuration: the timeout value exceeds the 3600-second upper bound. Very long timeouts would leave the gateway connection effectively hung, so the config is rejected at startup.","triggerScenarios":"Calling validate() with timeout > 3600, e.g. users setting timeout: 9999 or converting milliseconds (3600000) into a seconds field.","commonSituations":"Confusing milliseconds with seconds when porting configs; deliberately setting a huge timeout to 'never time out'; misreading the field's unit.","solutions":["Set timeout to a value between 1 and 3600 seconds","If you intended 3600000 ms, specify 3600 (the field is seconds)","If longer waits are needed, use retry logic instead of an oversized timeout"],"exampleFix":"// before\nlet config = IbAccountConfig { timeout: 3_600_000, ..base }; // ms mistake\n// after\nlet config = IbAccountConfig { timeout: 3_600, ..base }; // seconds","handlingStrategy":"validation","validationCode":"assert!((1..=3600).contains(&config.timeout), \"timeout must be 1..=3600 seconds\");","typeGuard":null,"tryCatchPattern":"if let Err(e) = config.validate() {\n    if e.to_string().contains(\"less than 3600\") {\n        eprintln!(\"timeout too large; field is in seconds, max 3600\");\n    }\n    anyhow::bail!(e);\n}","preventionTips":["Remember the timeout unit is seconds, cap 3600","Use retries for long-running waits rather than inflating timeout","Check for ms/second unit confusion when porting configs"],"tags":["rust","config","validation","timeout","interactive-brokers"],"backgroundTag":"value-out-of-range","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"}