Junie terminal commands hang -- /bin/sh: Illegal option -- when using WSL — fixed by deleting .idea folder
I wanted to share a fix in case anyone else runs into this, because it took a while to diagnose and the symptoms were pretty misleading.
Environment
- PhpStorm 2025.3
- Junie (JetBrains AI coding agent)
- Windows 11 + WSL2 (Ubuntu 24.04)
- Project opened from
\\wsl.localhost\Ubuntu-24.04\…
Symptoms
- Junie terminal actions would hang indefinitely (prompt opens, but no command is ever typed).
- Earlier I was seeing
/bin/sh: 0: Illegal option --, which I initially fixed by switching shells. - Even after fixing the shell (
bash, login shell confirmed,$SHELL=/bin/bash,ps -p $$showsbash --login -i), Junie still wouldn’t execute commands. - Running the same commands via cmd worked fine.
- No useful error surfaced in the IDE UI; logs showed various WSL / path / plugin noise.
At this point the shell itself was clearly fine — but Junie’s terminal integration was broken.
Root cause (in my case)
A corrupted / stale project configuration inside the .idea directory.
Something in the stored project state was preventing Junie’s terminal integration from initializing correctly in WSL.
Solution
- Close PhpStorm
- Delete the project’s
.ideafolder - Reopen the project in PhpStorm
- Let the IDE reindex and regenerate project settings
After doing this:
- Junie terminal commands execute normally
- No hanging prompts
- No
/bin/sherrors - WSL + bash integration works as expected
Takeaway
If Junie terminal commands:
- hang forever,
- or open a prompt but never run the command,
- especially after changing shells, WSL settings, or upgrading PhpStorm,
try deleting .idea before going deeper down the rabbit hole.
Hope this saves someone else some time.
Please sign in to leave a comment.
Hello Kevin,
Thank you for taking the time to document this fix, we truly appreciate the effort and high level of detail.