[BUG] Co-work Windows: sandbox environment leaks into child processes, breaking Unix domain socket IPC (JVM NIO, Gradle, MCP servers affected)
Status Fixed / completed
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
Activity 7 comments · opened Apr 7, 2026 · closed May 26, 2026
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?
When any Claude Desktop for windows builds have cowork setup and working, any attempt by CC to create a process that needs a unix domain socket fails, because its running in the restrictive AppContainer environment.
Sample stack:
Caused by: java.io.IOException: Unable to establish loopback connection
at java.base/sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:103)
at java.base/sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:67)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:569)
at java.base/sun.nio.ch.PipeImpl.<init>(PipeImpl.java:198)
at java.base/sun.nio.ch.WEPollSelectorImpl.<init>(WEPollSelectorImpl.java:78)
at java.base/sun.nio.ch.WEPollSelectorProvider.openSelector(WEPollSelectorProvider.java:33)
at java.base/java.nio.channels.Selector.open(Selector.java:295)
at org.gradle.internal.remote.internal.inet.SocketConnection$SocketInputStream.<init>(SocketConnection.java:164)
at org.gradle.internal.remote.internal.inet.SocketConnection.<init>(SocketConnection.java:62)
... 34 more
Caused by: java.net.SocketException: Invalid argument: connect
at java.base/sun.nio.ch.UnixDomainSockets.connect0(Native Method)
at java.base/sun.nio.ch.UnixDomainSockets.connect(UnixDomainSockets.java:148)
at java.base/sun.nio.ch.UnixDomainSockets.connect(UnixDomainSockets.java:144)
at java.base/sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:851)
What Should Happen?
CC should not be running bash commands in the AppContainer environment.
Error Messages/Logs
Steps to Reproduce
- Try to run a gradle process
- See error above.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
unknown
Claude Code Version
Claude 1.2.234 (2d1855) 2026-04-01T07:58:22.000Z
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
7 Comments
Found 1 possible duplicate issue:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Hi, any update?
Same issue for me
I have figured it out, sharing my workaround (I use gitbash for windows):
Heads-up: Gradle / any JVM tool fails in Claude Code on Windows with "Unable to establish loopback connection"
What you'll see
Running Gradle (or any Java command) from Claude Code's terminal on Windows fails with:
java.io.IOException: Unable to establish loopback connection
Caused by: java.net.SocketException: Invalid argument: connect
at sun.nio.ch.UnixDomainSockets.connect0(Native Method)
Same command works fine in your normal PowerShell/Git Bash terminal. Sandbox exclusions don't help
Cause
JDK 17+ on Windows uses WEPollSelectorImpl, which opens an AF_UNIX socket for its internal wakeup pipe. The socket path is built from %TEMP%. Windows' AF_UNIX (and POSIX in general) caps sockaddr_un.sun_path at 108 bytes.
In a normal terminal %TEMP% resolves cleanly (C:\Users\<you>\AppData\Local\Temp\...) and fits. Inside Claude Code's Cowork VM sandbox, the path gets resolved through the overlay filesystem, which prepends an internal prefix — pushing the final path past 108 bytes. The kernel returns EINVAL, every JVM in the sandbox dies on startup. Not fixed in JDK 21 or 25; the limit is an OS-level kernel ABI, not a JVM-tunable.
Related: claude-code#41432.
Fix
Point TEMP/TMP at a short path. In ~/.claude/settings.json:
Next, in your ~/.bashrc file add:
Note: you can't set TMP and TEMP env variables in your claude settings, because they're overriden by your system. bashrc loads last.
Then
mkdir C:\jtmpand restart Claude Code. Gradle, Maven, plain java — all work again.Hi, I see the issue is closed. Did you managed to shorten the temp path somehow? I know workaround, but it would be nice to fix it for all users, so they don't have to google it :)
This is very much NOT fixed!
There is a workaround, but the issue itself is not fixed
THANK YOU @jsamczuk , my tycho builds wouldn't run using Claude Code mode in Claude Desktop, same error and same root cause. Your workaround worked and I don't think I would've figured that out on my own.
I also hope that this gets fixed in the desktop client itself, it's a pity this issue got closed without an actual fix in the tool itself.