{"record":{"id":"090a2fd7755bd52d","repo":"Zackriya-Solutions/meetily","slug":"failed-to-create-core-audio-stream","errorCode":null,"errorMessage":"Failed to create Core Audio stream: {}","messagePattern":"Failed to create Core Audio stream: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/audio/stream.rs","lineNumber":165,"sourceCode":"        state: Arc<RecordingState>,\n        device_type: DeviceType,\n        recording_sender: Option<mpsc::UnboundedSender<super::recording_state::AudioChunk>>,\n    ) -> Result<Self> {\n        info!(\"🔊 Stream: Creating Core Audio stream for device: {}\", device.name);\n\n        // Create Core Audio capture\n        info!(\"🔊 Stream: Calling CoreAudioCapture::new()...\");\n        let capture_impl = CoreAudioCapture::new()\n            .map_err(|e| {\n                error!(\"❌ Stream: CoreAudioCapture::new() failed: {}\", e);\n                anyhow::anyhow!(\"Failed to create Core Audio capture: {}\", e)\n            })?;\n\n        info!(\"✅ Stream: CoreAudioCapture created, calling stream()...\");\n        let core_stream = capture_impl.stream()\n            .map_err(|e| {\n                error!(\"❌ Stream: capture_impl.stream() failed: {}\", e);\n                anyhow::anyhow!(\"Failed to create Core Audio stream: {}\", e)\n            })?;\n\n        let sample_rate = core_stream.sample_rate();\n        info!(\"✅ Stream: Core Audio stream created with sample rate: {} Hz\", sample_rate);\n\n        // Create audio capture processor for pipeline integration\n        // CRITICAL: Core Audio tap is MONO (with_mono_global_tap_excluding_processes)\n        let capture = AudioCapture::new(\n            device.clone(),\n            state.clone(),\n            sample_rate,\n            1, // Core Audio tap is MONO (not stereo!)\n            device_type,\n            recording_sender,\n        );\n\n        // Spawn task to process Core Audio stream samples\n        // The stream needs to be polled continuously to produce samples","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/audio/stream.rs#L147-L183","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Re-select a default output device in System Settings > Sound and retry","Reconnect/re-pair the output device (Bluetooth/USB) before starting recording","Close apps that hold the device exclusively","Restart coreaudiod (sudo killall coreaudiod) and retry"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Confirm a default output stream can actually be opened before recording\nfn default_output_stream_ready() -> bool {\n    CoreAudioCapture::new().and_then(|c| c.stream().map(|_| ())).is_ok()\n}","typeGuard":null,"tryCatchPattern":"// retry once after device re-selection, then degrade to mic-only (start_streams already warns instead of failing)\nmatch capture_impl.stream() {\n    Ok(s) => s,\n    Err(e) => {\n        warn!(\"System stream open failed: {e}; continuing microphone-only\");\n        return Ok(mic_only_setup());\n    }\n}","preventionTips":["Re-enumerate and re-select the default output device immediately before stream()","Handle device-removal events and stop system capture gracefully","Avoid exclusive-mode device usage by other apps while recording"],"tags":["macos","core-audio","audio-device","stream-open"],"backgroundTag":"coreaudio-stream-open-failed","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}