{"record":{"id":"a5dec76a762d4cb4","repo":"Hmbown/CodeWhale","slug":"invalid-sound-path","errorCode":null,"errorMessage":"invalid sound path","messagePattern":"invalid sound path","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/config/src/notifications.rs","lineNumber":241,"sourceCode":"            ),\n            K::SubagentCompletion => Self::SubagentCompletion(\n                SubagentCompletionNotification::parse(raw)\n                    .context(\"invalid subagent notification policy\")?,\n            ),\n            K::SoundFile => {\n                let value = raw.trim();\n                let value = if value.starts_with(['\\'', '\"']) {\n                    let parsed: toml::Table = toml::from_str(&format!(\"value = {value}\"))\n                        .context(\"invalid quoted sound path\")?;\n                    parsed\n                        .get(\"value\")\n                        .and_then(toml::Value::as_str)\n                        .context(\"expected sound path string\")?\n                        .to_string()\n                } else {\n                    value.to_string()\n                };\n                anyhow::ensure!(\n                    !value.is_empty()\n                        && value.len() <= 4096\n                        && !value.chars().any(char::is_control),\n                    \"invalid sound path\"\n                );\n                Self::SoundFile(PathBuf::from(value))\n            }\n            K::Event(event) => Self::Event(event, boolean()?),\n            K::EventSoundEnabled => Self::EventSoundEnabled(boolean()?),\n            K::EventSoundQuiet => Self::EventSoundQuiet(boolean()?),\n            K::EventSoundMinIntervalMs => Self::EventSoundMinIntervalMs(integer()?),\n            K::EventSoundEvents => {\n                anyhow::ensure!(raw.len() <= 1024, \"notification event list is too large\");\n                let parsed: toml::Table = toml::from_str(&format!(\"events = {raw}\"))\n                    .context(\"expected TOML notification event array\")?;\n                let values = parsed\n                    .get(\"events\")\n                    .and_then(toml::Value::as_array)","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/config/src/notifications.rs#L223-L259","documentation":"This error is thrown by NotificationConfigUpdate::parse when the value given for a sound file setting is not a usable path string: it must be non-empty, at most 4096 bytes, and contain no control characters. It guards against empty, oversized, or corrupted path values reaching the notification sound player.","triggerScenarios":"Calling NotificationConfigUpdate::parse with K::Sound where the raw TOML value is a string that is empty, longer than 4096 characters/bytes, or contains control characters (e.g. embedded \\n, \\0, or escape sequences that decode to control bytes).","commonSituations":"A user leaves sound = \"\" in the config; a config generator writes a path with a trailing newline or NUL byte; an overly long path from a deep directory tree exceeds 4096 bytes.","solutions":["Set the sound value to a non-empty absolute or relative path to an existing audio file, e.g. \"/usr/share/sounds/bell.ogg\".","Remove any control characters (newlines, NULs, escapes) from the path string.","Shorten the path — move the sound file to a shallower directory so the path is under 4096 bytes.","If you meant a built-in sound name rather than a file, use the corresponding non-file setting instead of SoundFile."],"exampleFix":"// before\nsound = \"\"\n// after\nsound = \"/usr/share/sounds/freedesktop/stereo/bell.oga\"","handlingStrategy":"validation","validationCode":"fn valid_sound_path(s: &str) -> bool {\n    !s.is_empty() && s.len() <= 4096 && !s.chars().any(char::is_control)\n}","typeGuard":null,"tryCatchPattern":"match update.validate() {\n    Err(e) if e.to_string().contains(\"invalid sound path\") => eprintln!(\"fix the sound path in config: {e}\"),\n    other => other?,\n}","preventionTips":["Trim user-supplied paths and reject empty strings","Check the sound file exists with Path::exists before configuring it","Strip control characters from any externally sourced path"],"tags":["config","path-validation"],"backgroundTag":"invalid-config-value","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"}