Hmbown/CodeWhale · error

notification event list is too large

Error message

notification event list is too large

What it means

This error is thrown by NotificationConfigUpdate::parse when handling the EventSoundEvents key whose raw string is longer than 1024 characters. The parser bounds the raw text before it re-parses it as a TOML array, preventing unbounded input from being fed into toml::from_str. It is a size guard, not a syntax check.

Solutions

  1. Shorten the events array to at most 6 short event names (also required by validation).
  2. Remove whitespace or quoting verbosity so the raw TOML text is within 1024 bytes.
  3. Split the configuration intent — track fewer events instead of a large list.
  4. Check that you are not accidentally embedding the entire config table where only the array is expected.

Example fix

// before
event_sound_events = ["a-very-long-event-name-...", "another-long-name", ...] // >1024 chars
// after
event_sound_events = ["turn-complete", "error"]
Defensive patterns

Strategy: validation

Validate before calling

if raw.len() > 1024 { return Err(anyhow::anyhow!("event list raw text exceeds 1024 bytes")); }

Prevention

When it happens

Trigger: Calling NotificationConfigUpdate::parse with K::EventSoundEvents and a raw string representation of the array (e.g. "[\"a\",\"b\",...]") whose length exceeds 1024 bytes.

Common situations: A user pastes a very long list of event names into the config; a tool serializes the whole events array with extra whitespace or comments making the raw representation exceed the limit; a long tail of custom event names accumulates over time.

Understand the failure class

Background: payload too large / request exceeds maximum size: why libraries cap bytes and how to fix oversize payloads — this error's family across 50 libraries.

Related errors


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

Appendix: source

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

                        .context("expected sound path string")?
                        .to_string()
                } else {
                    value.to_string()
                };
                anyhow::ensure!(
                    !value.is_empty()
                        && value.len() <= 4096
                        && !value.chars().any(char::is_control),
                    "invalid sound path"
                );
                Self::SoundFile(PathBuf::from(value))
            }
            K::Event(event) => Self::Event(event, boolean()?),
            K::EventSoundEnabled => Self::EventSoundEnabled(boolean()?),
            K::EventSoundQuiet => Self::EventSoundQuiet(boolean()?),
            K::EventSoundMinIntervalMs => Self::EventSoundMinIntervalMs(integer()?),
            K::EventSoundEvents => {
                anyhow::ensure!(raw.len() <= 1024, "notification event list is too large");
                let parsed: toml::Table = toml::from_str(&format!("events = {raw}"))
                    .context("expected TOML notification event array")?;
                let values = parsed
                    .get("events")
                    .and_then(toml::Value::as_array)
                    .context("expected notification event array")?;
                anyhow::ensure!(values.len() <= 6, "too many notification event names");
                let mut events = Vec::new();
                for value in values {
                    let event = value
                        .as_str()
                        .and_then(NotificationEvent::parse)
                        .context("unknown notification event")?;
                    if !events.iter().any(|value| value == event.as_str()) {
                        events.push(event.as_str().to_string());
                    }
                }
                Self::EventSoundEvents(events)

View on GitHub (pinned to 73e0f67d83)