Hmbown/CodeWhale · error

notification integer exceeds TOML range

Error message

notification integer exceeds TOML range

What it means

This error is thrown by NotificationConfigUpdate::parse when a user-supplied nonnegative integer for a notification setting exceeds the range TOML can represent, i.e. it is greater than i64::MAX. The parser first parses the raw string as u64 and then enforces the TOML/i64 bound via anyhow::ensure!. It exists so that a value written to the config can never overflow when later serialized back to TOML.

Solutions

  1. Lower the value to at most i64::MAX (9223372036854775807); for an interval in ms, use a sane value like 60000.
  2. Check for accidental unit confusion — seconds vs milliseconds can produce values 1000x too large.
  3. If generated programmatically, clamp the u64 before writing: value.min(i64::MAX as u64).
  4. Parse the value as i64 instead of u64 in your generator so the range is enforced at the source.

Example fix

// before
min_interval_ms = 18446744073709551615
// after
min_interval_ms = 60000
Defensive patterns

Strategy: validation

Validate before calling

fn valid_notification_int(v: u64) -> bool { v <= i64::MAX as u64 }
// call before constructing/parsing: if !valid_notification_int(ms) { clamp or reject }

Prevention

When it happens

Trigger: Calling NotificationConfigUpdate::parse (directly or via edit_extras) with a ThresholdSecs or EventSoundMinIntervalMs setting whose raw string parses as u64 but is greater than 9223372036854775807 (i64::MAX), e.g. "18446744073709551615".

Common situations: A user hand-edits notifications in the TOML file and types a huge number for a minimum interval in milliseconds, or a script generates config from an unbounded u64 counter/timestamp without clamping.

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.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/3ef9cd6d04b2387c. Report an issue: GitHub.

Appendix: source

Thrown at crates/config/src/notifications.rs:201

    EventSoundEvents(Vec<String>),
    EventSoundMinIntervalMs(u64),
    EventSoundQuiet(bool),
}

impl NotificationConfigUpdate {
    pub fn parse(setting: NotificationSetting, raw: &str) -> Result<Self> {
        use NotificationSetting as K;
        let boolean = || match raw.trim().to_ascii_lowercase().as_str() {
            "true" | "on" | "yes" | "1" => Ok(true),
            "false" | "off" | "no" | "0" => Ok(false),
            _ => bail!("expected a notification boolean"),
        };
        let integer = || {
            let value: u64 = raw
                .trim()
                .parse()
                .context("expected a nonnegative notification integer")?;
            anyhow::ensure!(
                value <= i64::MAX as u64,
                "notification integer exceeds TOML range"
            );
            Ok(value)
        };
        Ok(match setting {
            K::Method => {
                Self::Method(NotificationMethod::parse(raw).context("invalid notification method")?)
            }
            K::ThresholdSecs => Self::ThresholdSecs(integer()?),
            K::IncludeSummary => Self::IncludeSummary(boolean()?),
            K::Quiet => Self::Quiet(boolean()?),
            K::Sound if raw.trim().eq_ignore_ascii_case("legacy") => Self::Sound(None),
            K::Sound => Self::Sound(Some(
                CompletionSound::parse(raw).context("invalid notification sound")?,
            )),
            K::CompletionSound => Self::CompletionSound(
                CompletionSound::parse(raw).context("invalid completion sound")?,

View on GitHub (pinned to 73e0f67d83)