[BUG] Error: No suitable shell found. Claude CLI requires a Posix shell environment. Please ensure you have a valid shell installed and the SHELL environment variable set.
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Issue: Claude CLI gives "No suitable shell found" error even though:
- SHELL environment variable is correctly set (verified)
- Git Bash is installed and functional (verified with independent tests)
- All POSIX commands execute successfully (verified)
Potential Root Cause: Claude CLI's shell validation logic appears to only accept Unix-style
paths (starting with "/") and fails on valid Windows paths (starting with "C:\").
I was working in Claude code, locked my PC, and this morning I started to get this error "Error: No suitable shell found. Claude CLI requires a Posix shell environment. Please ensure you have a valid shell installed and the SHELL environment variable set.". Nothing has changed or updated. I checked the shell and its directed to the correct path. WSL is installed as well as cygwin and git bash. To make sure POSIX was working I ran some commands myself:
WSL (Windows Subsystem for Linux): All passed
wsl uname -a - Linux kernel 6.6.87.2
wsl ls -la - Directory listing successful
✅ wsl echo - Output working
Environment variable updated:
(I tried to see if the space between Program Files was causing an issue, still happened even when the length was shorted.) - All passed
$env:SHELL = C:\PROGRA~1\Git\bin\bash.exe
System SHELL = C:\PROGRA~1\Git\bin\bash.exe
All POSIX commands working:
uname -a → Linux DESKTOP-O065652 (WSL2)
pwd → /mnt/a/D/A
ls -la | head -5 → Directory listing with pipes working
grep → Pattern matching works
which bash → /usr/bin/bash found
Cant attach a pdf or run other things due to this error
What Should Happen?
Claude CLI should detect and use Git Bash on Windows when SHELL variable points to a valid bash executable.
Error Messages/Logs
Bash(echo "Testing POSIX shell detection")
⎿ Error: No suitable shell found. Claude CLI requires a Posix shell environment. Please ensure you have a valid shell installed and the SHELL environment variable set.
● Bash(uname -a)
⎿ Error: No suitable shell found. Claude CLI requires a Posix shell environment. Please ensure you have a valid shell installed and the SHELL environment variable set.
● Bash(pwd)
⎿ Error: No suitable shell found. Claude CLI requires a Posix shell environment. Please ensure you have a valid shell installed and the SHELL environment variable set.
Steps to Reproduce
1) Install claude
2) Run claude
3) Test POSIX
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
v2.0.50
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Warp
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗