Hmbown/CodeWhale · info · io::Error

WAV playback unsupported

Error message

WAV playback unsupported

What it means

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.

Solutions

  1. Treat ErrorKind::Unsupported as 'no audio available' and skip playback silently
  2. Check the platform at startup and disable audio notifications on unsupported targets
  3. Extend play_file with an implementation for the target platform (e.g. via a portable audio crate)
  4. Log the failure once instead of surfacing it to the user — audio is best-effort

Example fix

// before
play_file(&wav_path)?; // errors on unsupported platforms
// after
if let Err(e) = play_file(&wav_path) {
    if e.kind() == io::ErrorKind::Unsupported {
        log::debug!("notification sound unavailable on this platform");
    }
}
Defensive patterns

Strategy: fallback

Validate before calling

let audio_supported = cfg!(any(target_os = "windows", target_os = "macos", target_os = "linux"));
if !audio_supported {
    // skip sound, show visual notification only
}

Try / catch

if let Err(e) = play_file(&wav_path) {
    if e.kind() != io::ErrorKind::Unsupported {
        log::warn!("audio playback failed: {e}");
    } // Unsupported: silently skip
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


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

Appendix: source

Thrown at crates/tui/src/tui/notification_audio.rs:164

    let status = std::process::Command::new(player)
        .arg(path)
        .stdin(std::process::Stdio::null())
        .stdout(std::process::Stdio::null())
        .stderr(std::process::Stdio::null())
        .status()?;
    if status.success() {
        Ok(())
    } else {
        Err(io::Error::other("audio player failed"))
    }
}

#[cfg(all(
    not(test),
    not(any(target_os = "windows", target_os = "macos", target_os = "linux"))
))]
fn play_file(_path: &std::path::Path) -> io::Result<()> {
    Err(io::Error::new(
        io::ErrorKind::Unsupported,
        "WAV playback unsupported",
    ))
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn bundled_whale_is_the_complete_pcm_wav_without_clipped_samples() {
        assert_eq!(&WHALE_WAV[..4], b"RIFF");
        assert_eq!(&WHALE_WAV[8..12], b"WAVE");
        assert_eq!(WHALE_WAV.len(), 136754);
        assert_eq!(u16::from_le_bytes(WHALE_WAV[22..24].try_into().unwrap()), 1);
        assert_eq!(
            u32::from_le_bytes(WHALE_WAV[24..28].try_into().unwrap()),
            44100

View on GitHub (pinned to 73e0f67d83)