nautechsystems/nautilus_trader · error · anyhow::Error
Timeout must be greater than 0
Error message
Timeout must be greater than 0
What it means
The Interactive Brokers adapter config validation requires the request timeout to be strictly positive (seconds). A timeout of 0 would make IB client requests fail immediately or hang, so the adapter rejects it up front via IbAccountConfig::validate.
Source
Thrown at crates/adapters/interactive_brokers/src/config.rs:360
"*".repeat(value.len())
} else {
format!(
"{}{}{}",
&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 {View on GitHub (pinned to 18893faf8b)
Solutions
- Set timeout to a positive value, e.g. 60 seconds
- Check the config source (TOML/JSON/env) for a zero or missing timeout defaulting to 0
- Add a startup assertion/fail-fast around validate() before connecting
Example fix
// before
let config = IbAccountConfig { timeout: 0, ..base };
// after
let config = IbAccountConfig { timeout: 60, ..base }; Defensive patterns
Strategy: validation
Validate before calling
assert!(config.timeout > 0, "IB adapter timeout must be > 0");
Try / catch
if let Err(e) = config.validate() {
anyhow::bail!("invalid IB config: {e}"); // fail fast before connecting
} Prevention
- Always call validate() at startup before connecting to IB
- Set explicit timeouts (30–120s) instead of relying on defaults/env
- Validate config after loading from any source (file, env, CLI)
When it happens
Trigger: Instantiating the IB adapter with config where timeout is set to 0 (explicitly, via defaults overridden by environment/zero-valued variables) and calling validate(), typically at adapter startup.
Common situations: Config files with timeout: 0, environment variables parsed to 0, copy-pasted example configs omitting a real timeout, or wiring a different zero-valued field into timeout.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- Timeout must be less than 3600 seconds
- VNC port must be between 5900 and 5999
- heartbeat_secs must be positive when set
- signature_expiry_secs {signature_expiry_secs}s must be great
- instrument_ratios list needs to have at least 2 legs
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/f5d86992ae6d1a44.
Report an issue: GitHub.