Zackriya-Solutions/meetily · warning · anyhow::Error

No default output device found

Error message

No default output device found

What it means

get_macos_output asks cpal's default host for default_output_device() and it returned None - macOS/CoreAudio reports no default output device at all. Playback monitoring uses this to detect the current output (and whether it is Bluetooth) so audio streams can be reconfigured when devices change.

Source

Thrown at frontend/src-tauri/src/audio/playback_monitor.rs:41

    #[cfg(target_os = "windows")]
    {
        get_windows_output().await
    }

    #[cfg(target_os = "linux")]
    {
        get_linux_output().await
    }
}

#[cfg(target_os = "macos")]
async fn get_macos_output() -> Result<AudioOutputInfo> {
    use cpal::traits::{DeviceTrait, HostTrait};

    // Get default output device using cpal
    let host = cpal::default_host();
    let device = host.default_output_device()
        .ok_or_else(|| anyhow::anyhow!("No default output device found"))?;

    let device_name = device.name().unwrap_or_else(|_| "Unknown".to_string());

    // Get sample rate
    let sample_rate = device.default_output_config()
        .ok()
        .map(|config| config.sample_rate().0);

    // Heuristic: Check if device name contains bluetooth-related keywords
    let name_lower = device_name.to_lowercase();
    let is_bluetooth = name_lower.contains("airpods")
        || name_lower.contains("bluetooth")
        || name_lower.contains("wireless")
        || name_lower.contains("wh-")  // Sony WH-* series
        || name_lower.contains("beats")
        || name_lower.contains("bose")
        || name_lower.contains("jabra")
        || name_lower.contains("jbl")

View on GitHub (pinned to 0281737d87)

Solutions

  1. Connect or enable any output device and confirm it is selected as default in System Settings > Sound
  2. Toggle the Bluetooth device off/on (or re-pair) so CoreAudio reselects a default
  3. Restart coreaudiod when CoreAudio is stuck: sudo killall coreaudiod
  4. Skip playback monitoring in headless/VM environments

Example fix

// before
let device = host.default_output_device()
    .ok_or_else(|| anyhow::anyhow!("No default output device found"))?;

// after - degrade to a sentinel instead of failing the monitor
let device = match host.default_output_device() {
    Some(d) => d,
    None => return Ok(AudioOutputInfo {
        name: "No output device".to_string(),
        is_bluetooth: false,
        sample_rate: None,
        device_type: "none".to_string(),
    }),
};
Defensive patterns

Strategy: try-catch

Validate before calling

// Probe for any output device before asking for the default
use cpal::traits::HostTrait;
let host = cpal::default_host();
let has_output = host.output_devices().map(|mut d| d.next().is_some()).unwrap_or(false);
if !has_output {
    // skip playback monitoring this cycle
}

Try / catch

Catch the anyhow error at the playback-monitor call site and downgrade to a 'no output' sample (name: "None", is_bluetooth: false) so monitoring degrades instead of erroring; log at debug level.

Prevention

When it happens

Trigger: Machine has zero output devices (headless Mac mini, VM without audio hardware); the default device disappeared (Bluetooth headphones powered off, USB interface unplugged) and CoreAudio has not yet picked a successor; CoreAudio wedged after rapid device switching.

Common situations: AirPods turned off mid-session leaving no default; app launched before the audio subsystem is ready; running inside a VM or CI environment without audio passthrough.

Related errors


AI-assisted analysis of Zackriya-Solutions/meetily@0281737d87 (2026-08-16). Data as JSON: /api/errors/9aac7fb3986e6988. Report an issue: GitHub.