Voice mode incorrectly blocked on WSL even when audio recording tools are available
Bug Description
Voice mode is unconditionally blocked on WSL (Windows Subsystem for Linux) with the message:
Voice mode is not supported in WSL (Windows Subsystem for Linux) because audio devices are not available. To use voice mode, run Claude Code in native Windows instead.
This is incorrect. WSL2 supports audio via PulseAudio/PipeWire bridging to Windows, and tools like arecord (ALSA) and rec (SoX) work fine in WSL when properly configured.
Root Cause
In checkRecordingAvailability, the WSL detection check comes before the Linux fallback checks for arecord and rec:
1. Remote environment? → block
2. Native audio module available? → allow ✅
3. WSL detected? → block ❌ ← unconditional, never checks for arecord/rec
4. win32? → block
5. Linux + arecord? → allow
6. Linux + rec (SoX)? → allow
Since the native audio NAPI module typically doesn't load on WSL (it's compiled for native platforms), step 2 fails, and step 3 blocks WSL unconditionally — even though step 5 or 6 would succeed if reached.
Notably, checkVoiceDependencies does NOT have this WSL block and correctly falls through to the Linux checks. The same applies to startRecording, which correctly tries native audio first, then falls back to arecord/rec on Linux (including WSL). So the availability check is the only place with this inconsistency.
Proposed Fix
Remove the WSL-specific block in checkRecordingAvailability and let WSL fall through to the standard Linux checks (arecord, then rec/SoX). Since WSL reports process.platform === "linux", the existing Linux fallbacks will handle it correctly:
- If
arecordis available → voice mode works - If
rec(SoX) is available → voice mode works - If neither is available → user gets the standard "install SoX" message with the correct install command
This matches the behavior already implemented in checkVoiceDependencies and startRecording.
Environment
- Claude Code v2.1.71
- WSL2 (Ubuntu) on Windows
- Linux kernel: 6.6.87.2-microsoft-standard-WSL2
- PulseAudio utils installed and working
Labels
bug
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗