[BUG] /ide rejects valid JetBrains lockfile from WSL2 - "ps -p" can't see Windows PID, falsely treats live IDE as orphaned
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?
/ide fails to connect to a JetBrains IDE (Rider) when Claude Code is run from inside a WSL2 distro (from Rider's terminal), even though the IDE's lockfile contains the correct, matching workspace path. The failure is not a path-format mismatch - verified directly, see Error Messages/Logs - but appears to be a lockfile liveness-validation bug: when runningInWindows: true, the CLI's process-liveness check likely uses ps -p <pid>, which cannot see a Windows PID from inside WSL2, causing a valid lockfile to be treated as orphaned and rejected.
This is the same underlying mechanism reported in #14421 (closed via stale-bot, never fixed) and is related to but distinct from #62012, which describes a path-normalization bug between /mnt/<drive>/... and <DRIVE>:\... notation in a pure-PowerShell context with no WSL2 process boundary involved. In my case the workspace paths match byte-for-byte (confirmed directly below), ruling out path normalization as the cause here.
What Should Happen?
When validating a lockfile with runningInWindows: true, the CLI should use Windows-appropriate process checking (e.g. tasklist.exe) rather than ps -p, which cannot see Windows PIDs from a WSL2/Linux process. A valid, live IDE connection with a matching workspace path should be detected and connected via /ide, regardless of whether Claude Code itself is running as a native Windows process or inside WSL2.
Error Messages/Logs
Lockfile (`/mnt/c/Users/<user>/.claude/ide/*.lock`), written by the JetBrains Rider plugin:
{"workspaceFolders":["/mnt/d/<project-path>"], ... "runningInWindows":true, ...}
`pwd` from the WSL2 shell where `claude` is run:
/mnt/d/<project-path>
Identical strings — no trailing slash, no case difference. Despite this, `/ide` reports:
Found 1 other running IDE(s). However, their workspace/project directories do not match the current cwd.
● JetBrains Rider: /mnt/d/<project-path>
Additional evidence ruling out other causes:
curlfrom inside a Docker container (one layer further removed than plain WSL2) to the Windows-host SSE port succeeds and returns an HTTP response, confirming the port is reachable.- Manually setting
CLAUDE_CODE_SSE_PORTandENABLE_IDE_INTEGRATION=trueto the correct port did not resolve the connection. - The identical lockfile, read by
clauderunning as a native Windows process (plain PowerShell, no WSL2), connects to Rider successfully every time.
Steps to Reproduce
- On Windows, open a project in JetBrains Rider with the Claude Code [Beta] plugin installed and active.
- Confirm the plugin has written a lockfile to
%USERPROFILE%\.claude\ide\<pid>.lock, containing"runningInWindows":trueand aworkspaceFoldersentry in/mnt/<drive>/...notation. - Open a WSL2 terminal (e.g. Ubuntu) in Rider's terminal and
cdto the same project directory via its/mnt/<drive>/...path. - Confirm via
pwdthat the path matches the lockfile'sworkspaceFoldersentry exactly. - Run
claude, then/ide. - Observe: the IDE is listed but selecting it is rejected with "workspace/project directories do not match the current cwd," despite the paths being identical.
- For comparison: run
claudefrom a plain Windows PowerShell terminal (not WSL2) in Rider's terminal in the same directory, then/ide— this connects successfully using the same lockfile.
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
v2.1.195
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
WSL (Windows Subsystem for Linux)
Additional Information
Also reproduced one layer further removed, running claude inside a Docker container launched from WSL2 (container has host.docker.internal networking and a bind-mounted ~/.claude config directory pointing at the same Windows-side config). Same failure mode. Network reachability to the Windows-host SSE port was confirmed working via curl from inside the container, which rules out a firewall/NAT explanation and points specifically at the lockfile validation logic itself, not network-layer access.
Related issues, for context - these are not duplicates of this report:
- #14421 - describes the same
ps -p-vs-Windows-PID mechanism in detail (IntelliJ IDEA + WSL2 integrated terminal), including the suggestedtasklist.exefix. Closed by stale-bot without a fix. - #62012 - describes a related but distinct path-normalization bug (
/mnt/<drive>/...vs<DRIVE>:\...) in a pure-PowerShell context with no WSL2 involved. Worth keeping separate since the root cause and fix differ from this report.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗