{"record":{"id":"1c56b1824cd5e3f7","repo":"Hmbown/CodeWhale","slug":"wav-playback-unsupported","errorCode":null,"errorMessage":"WAV playback unsupported","messagePattern":"WAV playback unsupported","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"info","filePath":"crates/tui/src/tui/notification_audio.rs","lineNumber":164,"sourceCode":"    let status = std::process::Command::new(player)\n        .arg(path)\n        .stdin(std::process::Stdio::null())\n        .stdout(std::process::Stdio::null())\n        .stderr(std::process::Stdio::null())\n        .status()?;\n    if status.success() {\n        Ok(())\n    } else {\n        Err(io::Error::other(\"audio player failed\"))\n    }\n}\n\n#[cfg(all(\n    not(test),\n    not(any(target_os = \"windows\", target_os = \"macos\", target_os = \"linux\"))\n))]\nfn play_file(_path: &std::path::Path) -> io::Result<()> {\n    Err(io::Error::new(\n        io::ErrorKind::Unsupported,\n        \"WAV playback unsupported\",\n    ))\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    #[test]\n    fn bundled_whale_is_the_complete_pcm_wav_without_clipped_samples() {\n        assert_eq!(&WHALE_WAV[..4], b\"RIFF\");\n        assert_eq!(&WHALE_WAV[8..12], b\"WAVE\");\n        assert_eq!(WHALE_WAV.len(), 136754);\n        assert_eq!(u16::from_le_bytes(WHALE_WAV[22..24].try_into().unwrap()), 1);\n        assert_eq!(\n            u32::from_le_bytes(WHALE_WAV[24..28].try_into().unwrap()),\n            44100","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tui/notification_audio.rs#L146-L182","documentation":"notification_audio's play_file only has real implementations for Windows, macOS, and Linux. On any other target (the cfg(all(not(test), not(any(...)))) stub), it returns ErrorKind::Unsupported with 'WAV playback unsupported' — the notification sound simply cannot be played on that platform.","triggerScenarios":"A notification fires and tries to play the WAV on a target OS outside the three supported ones, or in a build configuration that compiled in the fallback stub.","commonSituations":"Running on an exotic/embedded Unix-like target; a misconfigured build where the platform cfg doesn't match expectations; cross-compiling to an unsupported triple.","solutions":["Treat ErrorKind::Unsupported as 'no audio available' and skip playback silently","Check the platform at startup and disable audio notifications on unsupported targets","Extend play_file with an implementation for the target platform (e.g. via a portable audio crate)","Log the failure once instead of surfacing it to the user — audio is best-effort"],"exampleFix":"// before\nplay_file(&wav_path)?; // errors on unsupported platforms\n// after\nif let Err(e) = play_file(&wav_path) {\n    if e.kind() == io::ErrorKind::Unsupported {\n        log::debug!(\"notification sound unavailable on this platform\");\n    }\n}","handlingStrategy":"fallback","validationCode":"let audio_supported = cfg!(any(target_os = \"windows\", target_os = \"macos\", target_os = \"linux\"));\nif !audio_supported {\n    // skip sound, show visual notification only\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = play_file(&wav_path) {\n    if e.kind() != io::ErrorKind::Unsupported {\n        log::warn!(\"audio playback failed: {e}\");\n    } // Unsupported: silently skip\n}","preventionTips":["Treat notification audio as best-effort everywhere","Check platform support before enabling the audio setting","Always pair sound with a visual notification","Log Unsupported once instead of erroring to the user"],"tags":["platform","audio","unsupported","notification"],"backgroundTag":"unsupported-platform","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"}