nautechsystems/nautilus_trader · error · anyhow::Error
Timeout must be less than 3600 seconds
Error message
Timeout must be less than 3600 seconds
What it means
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.
Source
Thrown at crates/adapters/interactive_brokers/src/config.rs:364
&value[0..1],
"*".repeat(value.len() - 2),
&value[value.len() - 1..]
)
}
}
/// Validate configuration.
///
/// # Errors
///
/// Returns an error if validation fails.
pub fn validate(&self) -> anyhow::Result<()> {
if self.timeout == 0 {
anyhow::bail!("Timeout must be greater than 0");
}
if self.timeout > 3600 {
anyhow::bail!("Timeout must be less than 3600 seconds");
}
if let Some(port) = self.vnc_port
&& (!(5900..=5999).contains(&port))
{
anyhow::bail!("VNC port must be between 5900 and 5999");
}
Ok(())
}
}
impl Default for DockerizedIBGatewayConfig {
fn default() -> Self {
Self::builder()
.maybe_username(std::env::var("TWS_USERNAME").ok().map(SecretString::from))
.maybe_password(std::env::var("TWS_PASSWORD").ok().map(SecretString::from))
.build()View on GitHub (pinned to 18893faf8b)
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
Example fix
// before
let config = IbAccountConfig { timeout: 3_600_000, ..base }; // ms mistake
// after
let config = IbAccountConfig { timeout: 3_600, ..base }; // seconds Defensive patterns
Strategy: validation
Validate before calling
assert!((1..=3600).contains(&config.timeout), "timeout must be 1..=3600 seconds");
Try / catch
if let Err(e) = config.validate() {
if e.to_string().contains("less than 3600") {
eprintln!("timeout too large; field is in seconds, max 3600");
}
anyhow::bail!(e);
} Prevention
- 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
When it happens
Trigger: Calling validate() with timeout > 3600, e.g. users setting timeout: 9999 or converting milliseconds (3600000) into a seconds field.
Common situations: Confusing milliseconds with seconds when porting configs; deliberately setting a huge timeout to 'never time out'; misreading the field's unit.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- Timeout must be greater than 0
- VNC port must be between 5900 and 5999
- heartbeat_secs must be positive when set
- heartbeat_timeout_secs must cover at least two server heartb
- signature_expiry_secs {signature_expiry_secs}s must be great
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/a21648da299c4bdc.
Report an issue: GitHub.