nautechsystems/nautilus_trader · error

order_request_rate_per_second must be greater than zero

Error message

order_request_rate_per_second must be greater than zero

What it means

BetfairExecutionClientConfig::validate() also requires order_request_rate_per_second to be strictly positive; this rate governs order-placement/management requests to Betfair. Zero would block order operations entirely, so validation bails.

Solutions

  1. Set order_request_rate_per_second to a positive integer (typically equal to or below the general request rate)
  2. Run cfg.validate()? at startup and inspect all rate fields
  3. Keep both rates consistent with Betfair account limits

Example fix

// before (toml)
[betfair]
request_rate_per_second = 10
order_request_rate_per_second = 0
// after
[betfair]
request_rate_per_second = 10
order_request_rate_per_second = 10
Defensive patterns

Strategy: validation

Validate before calling

if cfg.order_request_rate_per_second == 0 {
    return Err(anyhow!("order_request_rate_per_second must be > 0"));
}
cfg.validate()?;

Type guard

fn positive_order_rate(r: u32) -> bool { r > 0 }

Try / catch

cfg.validate().with_context(|| format!("bad rate: {}", cfg.order_request_rate_per_second))?;

Prevention

When it happens

Trigger: validate() called with order_request_rate_per_second == 0 in the execution client config, even if request_rate_per_second itself is valid.

Common situations: Setting only request_rate_per_second and leaving the order rate at 0 in a hand-written config; template configs with placeholder zeros; misreading the field as a boolean/toggle.

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


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/9e0e09a32002090b. Report an issue: GitHub.

Appendix: source

Thrown at crates/adapters/betfair/src/config.rs:466

            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()?;

        if self.request_rate_per_second == 0 {
            anyhow::bail!("request_rate_per_second must be greater than zero");
        }

        if self.order_request_rate_per_second == 0 {
            anyhow::bail!("order_request_rate_per_second must be greater than zero");
        }

        self.stream_config().validate()?;

        Ok(())
    }
}

#[cfg(test)]
mod tests {
    use rstest::rstest;

    use super::*;

    #[rstest]
    fn test_config_debug_redacts_credentials() {
        let data = BetfairDataClientConfig {
            username: Some("data-username".into()),

View on GitHub (pinned to 18893faf8b)