Zackriya-Solutions/meetily · error

Failed to get default input config: {}

Error message

Failed to get default input config: {}

What it means

Wrapped cpal error from Device::default_input_config() while get_cpal_device (configuration.rs:132) iterated the default host input devices looking for an exact name match. The device object was found by name, but querying its default stream config failed - cpal reports the underlying host error (DeviceNotAvailable on macOS CoreAudio, ALSA errors on Linux). The anyhow! with ? aborts the whole device search, so later candidates and the not-found error are never reached.

Source

Thrown at frontend/src-tauri/src/audio/devices/configuration.rs:132

    #[cfg(target_os = "windows")]
    {
        return super::platform::get_windows_device(audio_device);
    }

    #[cfg(not(target_os = "windows"))]
    {
        use cpal::traits::{DeviceTrait, HostTrait};

        let host = cpal::default_host();

        match audio_device.device_type {
            DeviceType::Input => {
                for device in host.input_devices()? {
                    if let Ok(name) = device.name() {
                        if name == audio_device.name {
                            let default_config = device
                                .default_input_config()
                                .map_err(|e| anyhow!("Failed to get default input config: {}", e))?;
                            return Ok((device, default_config));
                        }
                    }
                }
            }
            DeviceType::Output => {
                #[cfg(target_os = "macos")]
                {
                    // Use default host for all macOS output devices
                    // Core Audio backend uses direct cidre API for system capture, not cpal
                    for device in host.output_devices()? {
                        if let Ok(name) = device.name() {
                            if name == audio_device.name {
                                let default_config = device
                                    .default_output_config()
                                    .map_err(|e| anyhow!("Failed to get output config: {}", e))?;
                                return Ok((device, default_config));
                            }

View on GitHub (pinned to 0281737d87)

Solutions

  1. Check the inner cpal error string - it distinguishes permission vs device-gone vs host errors.
  2. Re-run list_audio_devices (refresh the device list in the UI) and confirm the device still appears before retrying start_recording.
  3. On macOS, grant Microphone access (System Settings > Privacy & Security > Microphone) and restart the app.
  4. Reconnect/reselect the device (re-pair Bluetooth, replug USB) or fall back to the default input via default_input_device().
  5. Longer term: in get_cpal_device, treat a per-device config failure as skip-and-continue instead of aborting with ?, so other candidates or the final Device-not-found path apply.

Example fix

// before: first matching device's config failure aborts the search
let default_config = device.default_input_config()
    .map_err(|e| anyhow!("Failed to get default input config: {}", e))?;

// after: skip devices whose config query fails, keep searching
match device.default_input_config() {
    Ok(cfg) => return Ok((device, cfg)),
    Err(e) => { warn!("Skipping device '{}' config error: {}", name, e); continue; }
}
Defensive patterns

Strategy: fallback

Validate before calling

// Rust: confirm the device still enumerates before asking for its config
fn device_still_listed(target: &str) -> bool {
    cpal::default_host().input_devices()
        .map(|it| it.any(|d| d.name().map(|n| n == target).unwrap_or(false)))
        .unwrap_or(false)
}
if !device_still_listed(&name) { /* refresh picker / use default instead */ }

Try / catch

// Catch the wrapped cpal error and degrade to the default input device
let (dev, cfg) = match get_cpal_device(&audio_device) {
    Ok(found) => found,
    Err(e) if e.to_string().starts_with("Failed to get default input config") => {
        warn!("Selected mic unavailable ({}); using default", e);
        default_input_device_config()? // explicit fallback path
    }
    Err(e) => return Err(e),
};

Prevention

When it happens

Trigger: A matching input device exists in enumeration but is unplugged/disabled between enumeration and the config query; macOS microphone permission not granted (CoreAudio errors on input config queries); an exclusive-mode app (ASIO/DVO) holds the device; a Bluetooth headset that disappeared mid-pairing; a Linux PulseAudio/ALSA device whose source became unavailable.

Common situations: Selecting a USB headset then unplugging it before start_recording; first launch on macOS with mic permission denied in System Settings; Bluetooth headset sleeping between device list refresh and record start; enumeration ghosts from devices whose names differ only by invisible Unicode.

Related errors


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