Hmbown/CodeWhale · error

expected a notification boolean

Error message

expected a notification boolean

What it means

NotificationConfigUpdate::parse converts a raw string value for a notification setting into a typed update. Boolean settings (e.g. include-summary, quiet flags, event sound toggles in the notifications namespace) are parsed by the `boolean` closure, which accepts true/on/yes/1 and false/off/no/0 (case-insensitive, trimmed). Anything else — such as "enabled", "2", or an empty string — fails with this error.

Solutions

  1. Use one of the accepted spellings: true, on, yes, 1 (or false, off, no, 0)
  2. Check for stray quotes or embedded characters around the value in config.toml
  3. Confirm the setting key you're writing is actually a boolean setting; integer settings need a nonnegative number

Example fix

// before
set_value("notifications.include-summary", "enabled")
// after
set_value("notifications.include-summary", "true")
Defensive patterns

Strategy: validation

Validate before calling

fn is_notification_boolean(raw: &str) -> bool {
    matches!(raw.trim().to_ascii_lowercase().as_str(),
        "true" | "on" | "yes" | "1" | "false" | "off" | "no" | "0")
}

Type guard

fn parse_bool_token(raw: &str) -> Option<bool> {
    match raw.trim().to_ascii_lowercase().as_str() {
        "true" | "on" | "yes" | "1" => Some(true),
        "false" | "off" | "no" | "0" => Some(false),
        _ => None,
    }
}

Try / catch

match NotificationConfigUpdate::parse(setting, raw) {
    Ok(update) => update,
    Err(e) if e.to_string().contains("expected a notification boolean") => {
        eprintln!("'{}' is not a boolean; use true/on/yes/1 or false/off/no/0", raw);
        Default::default()
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling ConfigToml::set_value with a key in the notifications namespace whose setting is boolean-kind and a value like "enabled", "sure", "2", or "".

Common situations: Typing natural language into the config setter instead of a boolean token, scripts writing locale-specific truthy strings, or quoting errors in config.toml leaving an empty value.

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 Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/c8bb2027c31b03ab. Report an issue: GitHub.

Appendix: source

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

    Sound(Option<CompletionSound>),
    Condition(NotificationCondition),
    CompletionSound(CompletionSound),
    SubagentCompletion(SubagentCompletionNotification),
    SoundFile(PathBuf),
    Event(NotificationEvent, bool),
    EventSoundEnabled(bool),
    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()?),

View on GitHub (pinned to 73e0f67d83)