{"record":{"id":"3ef9cd6d04b2387c","repo":"Hmbown/CodeWhale","slug":"notification-integer-exceeds-toml-range","errorCode":null,"errorMessage":"notification integer exceeds TOML range","messagePattern":"notification integer exceeds TOML range","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/config/src/notifications.rs","lineNumber":201,"sourceCode":"    EventSoundEvents(Vec<String>),\n    EventSoundMinIntervalMs(u64),\n    EventSoundQuiet(bool),\n}\n\nimpl NotificationConfigUpdate {\n    pub fn parse(setting: NotificationSetting, raw: &str) -> Result<Self> {\n        use NotificationSetting as K;\n        let boolean = || match raw.trim().to_ascii_lowercase().as_str() {\n            \"true\" | \"on\" | \"yes\" | \"1\" => Ok(true),\n            \"false\" | \"off\" | \"no\" | \"0\" => Ok(false),\n            _ => bail!(\"expected a notification boolean\"),\n        };\n        let integer = || {\n            let value: u64 = raw\n                .trim()\n                .parse()\n                .context(\"expected a nonnegative notification integer\")?;\n            anyhow::ensure!(\n                value <= i64::MAX as u64,\n                \"notification integer exceeds TOML range\"\n            );\n            Ok(value)\n        };\n        Ok(match setting {\n            K::Method => {\n                Self::Method(NotificationMethod::parse(raw).context(\"invalid notification method\")?)\n            }\n            K::ThresholdSecs => Self::ThresholdSecs(integer()?),\n            K::IncludeSummary => Self::IncludeSummary(boolean()?),\n            K::Quiet => Self::Quiet(boolean()?),\n            K::Sound if raw.trim().eq_ignore_ascii_case(\"legacy\") => Self::Sound(None),\n            K::Sound => Self::Sound(Some(\n                CompletionSound::parse(raw).context(\"invalid notification sound\")?,\n            )),\n            K::CompletionSound => Self::CompletionSound(\n                CompletionSound::parse(raw).context(\"invalid completion sound\")?,","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/config/src/notifications.rs#L183-L219","documentation":"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.","triggerScenarios":"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\".","commonSituations":"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.","solutions":["Lower the value to at most i64::MAX (9223372036854775807); for an interval in ms, use a sane value like 60000.","Check for accidental unit confusion — seconds vs milliseconds can produce values 1000x too large.","If generated programmatically, clamp the u64 before writing: value.min(i64::MAX as u64).","Parse the value as i64 instead of u64 in your generator so the range is enforced at the source."],"exampleFix":"// before\nmin_interval_ms = 18446744073709551615\n// after\nmin_interval_ms = 60000","handlingStrategy":"validation","validationCode":"fn valid_notification_int(v: u64) -> bool { v <= i64::MAX as u64 }\n// call before constructing/parsing: if !valid_notification_int(ms) { clamp or reject }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Clamp u64 config values with .min(i64::MAX as u64) before writing","Watch for seconds-vs-milliseconds unit confusion","Validate generated TOML with the library's parse before persisting"],"tags":["config","toml","integer-overflow"],"backgroundTag":"value-out-of-range","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}