Zackriya-Solutions/meetily · error
Failed to create WASAPI host: {}
Error message
Failed to create WASAPI host: {} What it means
get_windows_device (windows.rs:99) requests the WASAPI host explicitly via cpal::host_from_id(HostId::Wasapi) and that call failed. On Windows the app pins WASAPI for both capture and loopback instead of the implicit default host. host_from_id fails when the cpal build does not include the WASAPI backend (feature flags) or the host cannot be initialized in this process/session.
Source
Thrown at frontend/src-tauri/src/audio/devices/platform/windows.rs:99
}
// Try to add default output device
if let Some(device) = host.default_output_device() {
if let Ok(name) = device.name() {
// info!("Adding default output device: {}", name);
devices.push(AudioDevice::new(name, DeviceType::Output));
}
}
}
debug!("Found {} Windows audio devices", devices.len());
Ok(devices)
}
/// Get Windows device and configuration using WASAPI
pub fn get_windows_device(audio_device: &AudioDevice) -> Result<(cpal::Device, cpal::SupportedStreamConfig)> {
let wasapi_host = cpal::host_from_id(cpal::HostId::Wasapi)
.map_err(|e| anyhow!("Failed to create WASAPI host: {}", e))?;
// Extract the base device name without the (input) or (output) suffix
let base_name = if audio_device.name.ends_with(" (input)") {
audio_device.name.trim_end_matches(" (input)")
} else if audio_device.name.ends_with(" (output)") {
audio_device.name.trim_end_matches(" (output)")
} else {
&audio_device.name
};
info!("Looking for Windows device with base name: {}", base_name);
match audio_device.device_type {
DeviceType::Input => {
for device in wasapi_host.input_devices()? {
if let Ok(name) = device.name() {
info!("Checking input device: {}", name);
// Check if the device name contains our base nameView on GitHub (pinned to 0281737d87)
Solutions
- Confirm the error text after the colon - a host-not-found/initialized message from cpal pinpoints the feature/init issue.
- Rebuild with the default Windows feature set (pnpm run tauri:build, or cargo build) without --no-default-features; verify cpal is not pinned to a stripped version in Cargo.lock.
- If the Windows Audio service is disabled: sc config Audiosrv start= auto, start it, relaunch the app.
- Run the app as a normal interactive user session, not as a service/SYSTEM.
- Keep this module behind #[cfg(target_os = "windows")] at the call site so it never executes off-Windows.
Example fix
# before: custom stripped build drops the wasapi backend cargo build --no-default-features # after: build with platform default features so HostId::Wasapi resolves cargo build # or: pnpm run tauri:build
Defensive patterns
Strategy: validation
Validate before calling
// Compile-time guard: never execute the WASAPI path off-Windows or without the backend
#[cfg(all(target_os = "windows", feature = "wasapi"))]
fn resolve_device(d: &AudioDevice) -> Result<(cpal::Device, cpal::SupportedStreamConfig)> {
get_windows_device(d)
} Try / catch
// Distinguish infrastructure failure from device failure so the UI can advise correctly
match get_windows_device(&dev) {
Err(e) if e.to_string().starts_with("Failed to create WASAPI host") => {
return Err(anyhow!("Audio backend unavailable - restart the Windows Audio service or reinstall the app"));
}
other => other,
} Prevention
- Build Windows binaries with default cargo features; never --no-default-features without auditing cpal.
- Keep the Windows Audio service (Audiosrv) enabled on hardened machines.
- Gate this module behind #[cfg(target_os = "windows")] so cross-target runs never reach it.
When it happens
Trigger: A build compiled for a non-Windows target or with cpal wasapi feature disabled (build script misconfiguration, wrong --target); calling the Windows path from a context where COM/audio services are unavailable (Windows audio service stopped, early service-session startup, sandboxed service account). Rare on stock Windows 10/11 where WASAPI is always present.
Common situations: CI cross-compilation dropping the wasapi feature; custom cargo build with --no-default-features; Windows Audio service (Audiosrv) disabled for hardening; running the binary as a service before the audio endpoint is ready; Wine/Proton environments with partial WASAPI emulation.
Related errors
- No compatible input configuration found for device: {}
- Device not found or no compatible configuration available: {
- Failed to get default input config: {}
- Failed to get output config: {}
- Device not found: {}
AI-assisted analysis of Zackriya-Solutions/meetily@0281737d87 (2026-08-16).
Data as JSON: /api/errors/6442091285858b22.
Report an issue: GitHub.