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

Failed to create Core Audio stream: {}

Error message

Failed to create Core Audio stream: {}

What it means

CoreAudioCapture::new() succeeded but capture_impl.stream() failed to open the underlying Core Audio device stream. The capture object exists; opening the default output stream failed - usually because there is no usable default output device or it cannot deliver audio right now.

Source

Thrown at frontend/src-tauri/src/audio/stream.rs:165

        state: Arc<RecordingState>,
        device_type: DeviceType,
        recording_sender: Option<mpsc::UnboundedSender<super::recording_state::AudioChunk>>,
    ) -> Result<Self> {
        info!("🔊 Stream: Creating Core Audio stream for device: {}", device.name);

        // Create Core Audio capture
        info!("🔊 Stream: Calling CoreAudioCapture::new()...");
        let capture_impl = CoreAudioCapture::new()
            .map_err(|e| {
                error!("❌ Stream: CoreAudioCapture::new() failed: {}", e);
                anyhow::anyhow!("Failed to create Core Audio capture: {}", e)
            })?;

        info!("✅ Stream: CoreAudioCapture created, calling stream()...");
        let core_stream = capture_impl.stream()
            .map_err(|e| {
                error!("❌ Stream: capture_impl.stream() failed: {}", e);
                anyhow::anyhow!("Failed to create Core Audio stream: {}", e)
            })?;

        let sample_rate = core_stream.sample_rate();
        info!("✅ Stream: Core Audio stream created with sample rate: {} Hz", sample_rate);

        // Create audio capture processor for pipeline integration
        // CRITICAL: Core Audio tap is MONO (with_mono_global_tap_excluding_processes)
        let capture = AudioCapture::new(
            device.clone(),
            state.clone(),
            sample_rate,
            1, // Core Audio tap is MONO (not stereo!)
            device_type,
            recording_sender,
        );

        // Spawn task to process Core Audio stream samples
        // The stream needs to be polled continuously to produce samples

View on GitHub (pinned to 0281737d87)

Solutions

  1. Re-select a default output device in System Settings > Sound and retry
  2. Reconnect/re-pair the output device (Bluetooth/USB) before starting recording
  3. Close apps that hold the device exclusively
  4. Restart coreaudiod (sudo killall coreaudiod) and retry
Defensive patterns

Strategy: try-catch

Validate before calling

// Confirm a default output stream can actually be opened before recording
fn default_output_stream_ready() -> bool {
    CoreAudioCapture::new().and_then(|c| c.stream().map(|_| ())).is_ok()
}

Try / catch

// retry once after device re-selection, then degrade to mic-only (start_streams already warns instead of failing)
match capture_impl.stream() {
    Ok(s) => s,
    Err(e) => {
        warn!("System stream open failed: {e}; continuing microphone-only");
        return Ok(mic_only_setup());
    }
}

Prevention

When it happens

Trigger: The default output device is unset, held exclusively by another app, or disappeared between enumeration and stream open (Bluetooth headphones disconnecting, HDMI monitor sleeping, USB interface unplugged); sample-rate/format negotiation with the HAL fails.

Common situations: A Bluetooth device disconnecting right before recording starts; aggregate-device creation failures after macOS updates; devices held in exclusive mode by DAW software (Logic, Audio Hijack).

Related errors


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