{"record":{"id":"d74288ad612b5652","repo":"Zackriya-Solutions/meetily","slug":"failed-to-get-microphone-config","errorCode":null,"errorMessage":"Failed to get microphone config: {}","messagePattern":"Failed to get microphone config: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/audio/devices/discovery.rs","lineNumber":127,"sourceCode":"/// audio. Deliberately minimal: it checks the default\n/// input device and treats the first callback as \"granted\" (no sample-content\n/// inspection, no per-selected-device check).\npub async fn verify_microphone_access() -> anyhow::Result<()> {\n    use log::{info, warn};\n    use std::sync::atomic::{AtomicBool, Ordering};\n    use std::sync::Arc;\n\n    tokio::task::spawn_blocking(|| {\n        let host = cpal::default_host();\n        let Some(device) = host.default_input_device() else {\n            // Let device resolution handle the existing system-audio-only fallback.\n            info!(\"[verify_microphone_access] No microphone device found; skipping access check\");\n            return Ok(());\n        };\n\n        let config = device\n            .default_input_config()\n            .map_err(|e| anyhow::anyhow!(\"Failed to get microphone config: {}\", e))?;\n\n        let callback_fired = Arc::new(AtomicBool::new(false));\n        let callback_fired_clone = callback_fired.clone();\n\n        let stream = device\n            .build_input_stream(\n                &config.into(),\n                move |_data: &[f32], _: &cpal::InputCallbackInfo| {\n                    callback_fired_clone.store(true, Ordering::SeqCst);\n                },\n                |err| warn!(\"[verify_microphone_access] test stream error: {}\", err),\n                None,\n            )\n            .map_err(|e| anyhow::anyhow!(\"Cannot access microphone: {}\", e))?;\n\n        stream\n            .play()\n            .map_err(|e| anyhow::anyhow!(\"Cannot start microphone: {}\", e))?;","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/a2cb62e827da7ef59f65064c97233efb2313878e/frontend/src-tauri/src/audio/devices/discovery.rs#L109-L145","documentation":"verify_microphone_access opens the default input device and calls default_input_config() via cpal to obtain a stream configuration. If cpal cannot produce a default input configuration for the device, the error is wrapped with anyhow! into this message. It means the device exists but cpal could not negotiate any supported input format.","triggerScenarios":"Calling verify_microphone_access() on a machine where device.default_input_config() returns Err - e.g. no supported sample formats/rates for the selected input device, or the device disappeared between enumeration and config.","commonSituations":"Microphone unplugged or USB interface powered off mid-session; virtual audio drivers (BlackHole, VB-Cable) with unusual formats; Linux box without proper ALSA/Pulse config; stale default device after OS audio settings change.","solutions":["Verify the microphone is connected and selected as the OS default input device.","Re-enumerate devices (list_audio_devices) and retry with an explicit valid device instead of the default.","On Linux, check PulseAudio/PipeWire/ALSA configuration (e.g. pactl info, default source).","Update audio drivers (Windows WASAPI) or virtual-device drivers (macOS BlackHole), then restart the app."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"match verify_microphone_access().await {\n    Ok(()) => start_recording(),\n    Err(e) if e.to_string().contains(\"Failed to get microphone config\") => {\n        // prompt re-enumeration / device reselection\n        prompt_device_reselect();\n    }\n    Err(e) => show_error(e),\n}","preventionTips":["Re-enumerate devices right before verification instead of caching handles.","Fall back to the next available input device when the default fails.","On Linux, validate PulseAudio/PipeWire default source at startup.","Warn users when a virtual audio device is the default input."],"tags":["audio","cpal","microphone","device-config"],"backgroundTag":"resource-not-found","analyzedSha":"a2cb62e827da7ef59f65064c97233efb2313878e","analyzedAt":"2026-09-12T11:12:14.152Z","contentChangedAt":"2026-09-12T11:12:14.152Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}