Voice mode fails on WSL2 despite arecord/sox being available

Resolved 💬 3 comments Opened Mar 21, 2026 by junix1 Closed Mar 21, 2026

Bug Description

/voice command always fails on WSL2 with the error:

Voice mode could not access an audio device in WSL.

WSL2 with WSLg (Windows 11) provides audio via PulseAudio — if you are on Windows 10 or WSL1, run Claude Code in native Windows instead.

This happens even when PulseAudio is fully functional and both arecord and rec (sox) are installed and working.

Root Cause

In the availability check function (ie6 in the minified source), the WSL code path checks only isNativeAudioAvailable() (the native audio-capture-napi module). When that returns false, it immediately returns an error without falling back to arecord or rec — unlike the non-WSL Linux code path which does try these fallbacks.

Relevant logic (reconstructed from binary strings):

// availability check
if ((await ytH()).isNativeAudioAvailable()) return { available: true, reason: null };
// WSL: immediately returns error here, never checks arecord/rec
let $ = `Voice mode could not access an audio device in WSL.`

Meanwhile, the separate le6 function (used elsewhere) correctly implements the fallback:

if ((await ytH()).isNativeAudioAvailable()) return { available: true, missing: [], installCommand: null };
if (yLH("arecord")) return { available: true, missing: [], installCommand: null };  // ← this fallback is missing in WSL availability check

Environment

  • OS: Ubuntu 24.04 on WSL2 (Windows 11, WSLg enabled)
  • Kernel: Linux 6.6.87.2-microsoft-standard-WSL2
  • Claude Code version: 2.1.81
  • Architecture: x86_64
  • PulseAudio: Working via WSLg (/mnt/wslg/PulseServer exists, pactl info connects successfully)
  • RDPSource/RDPSink: Present and functional
  • arecord: installed (alsa-utils 1.2.9)
  • rec/sox: installed (SoX 14.4.2)

Expected Behavior

On WSL2 with WSLg, if the native audio module fails but arecord or rec is available and PulseAudio is connected, voice mode should fall back to those tools — same as on non-WSL Linux.

Workaround Attempted

Setting WSL_DISTRO_NAME="" WSL_INTEROP="" to bypass WSL detection has not been tested as a reliable workaround yet.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗