nautechsystems/nautilus_trader · error
request_rate_per_second must be greater than zero
Error message
request_rate_per_second must be greater than zero
What it means
BetfairDataConfig::validate() checks market-data stream parameters before the adapter starts. request_rate_per_second is a positive rate limit for Betfair API requests; zero would stall or starve the request loop, so validation bails with this error.
Solutions
- Set request_rate_per_second to a positive integer (e.g. 5-20, within Betfair's transaction rate allowance)
- Validate config early with cfg.validate()? at startup and correct the value
- Use a sane default constant instead of a zero literal
Example fix
// before (toml) [betfair.data] request_rate_per_second = 0 // after [betfair.data] request_rate_per_second = 10
Defensive patterns
Strategy: validation
Validate before calling
assert!(cfg.request_rate_per_second > 0, "request_rate_per_second must be > 0"); cfg.validate()?;
Type guard
fn valid_rate(r: u32) -> bool { r > 0 } Try / catch
if let Err(e) = cfg.validate() {
eprintln!("invalid Betfair data config: {e:#}");
return Err(e);
} Prevention
- Never set rate fields to 0 meaning 'unlimited' — use a positive default
- Run validate() immediately after deserializing config
- Keep rate values within Betfair account transaction limits
When it happens
Trigger: Calling validate() on BetfairDataConfig (during adapter startup/build) with request_rate_per_second == 0, e.g. parsed from a config file where the field is 0 or defaulted improperly.
Common situations: Writing `request_rate_per_second = 0` intending 'unlimited'; forgetting the field and relying on a zero Default; programmatic config construction passing 0.
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.
Related errors
- order_request_rate_per_second must be greater than zero
- heartbeat_secs must be positive when set
- heartbeat_timeout_secs must cover at least two server…
- Invalid account currency code
- Invalid
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/eb5a35fd11d6a827.
Report an issue: GitHub.
Appendix: source
Thrown at crates/adapters/betfair/src/config.rs:296
self.stream_heartbeat_timeout_secs,
self.stream_reconnect_delay_initial_ms,
self.stream_reconnect_delay_max_ms,
self.stream_use_tls,
)
}
/// Validates the configuration.
///
/// # Errors
///
/// Returns an error if any configured value is invalid.
pub fn validate(&self) -> anyhow::Result<()> {
let _ = self.currency()?;
validate_market_start_time("min_market_start_time", &self.min_market_start_time)?;
validate_market_start_time("max_market_start_time", &self.max_market_start_time)?;
if self.request_rate_per_second == 0 {
anyhow::bail!("request_rate_per_second must be greater than zero");
}
self.stream_config().validate()?;
Ok(())
}
}
/// Configuration for the Betfair live execution client.
#[derive(Debug, Clone, Serialize, Deserialize, bon::Builder)]
#[serde(default, deny_unknown_fields)]
#[cfg_attr(
feature = "python",
pyo3::pyclass(module = "nautilus_trader.adapters.betfair", from_py_object)
)]
#[cfg_attr(
feature = "python",
pyo3_stub_gen::derive::gen_stub_pyclass(module = "nautilus_trader.adapters.betfair")View on GitHub (pinned to 18893faf8b)