[BUG] Claude Code bash tool fails on HPC/SLURM compute nodes
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?
Claude Code's bash tool fails with EACCES: permission denied, mkdir '/run/user/<UID>' on SLURM compute nodes, even when XDG_RUNTIME_DIR is correctly set to a writable location.
Environment:
Claude Code v2.1.19
SLURM HPC cluster (compute nodes don't have systemd user sessions)
Linux
Notes:
File operations (read/write/search) work fine - only bash tool is affected
Works correctly on login nodes where /run/user/<UID> exists
Node.js/Claude Code appears to hard-code /run/user/<UID> and ignore the environment variable
What Should Happen?
Expected: Bash command executes using the writable XDG_RUNTIME_DIR
Actual: Error: EACCES: permission denied, mkdir '/run/user/5540'
Error Messages/Logs
Error: EACCES: permission denied, mkdir '/run/user/5540'
Steps to Reproduce
SSH to an HPC login node (works fine there)
Get an interactive session on a compute node: srun --pty bash -l
Set XDG_RUNTIME_DIR to a writable path: export XDG_RUNTIME_DIR=/tmp/runtime-$USER-$$; mkdir -p $XDG_RUNTIME_DIR
Verify it's set: echo $XDG_RUNTIME_DIR shows /tmp/runtime-poeschla-2140667
Launch Claude: XDG_RUNTIME_DIR=/tmp/runtime-$USER claude
Try any bash command (e.g., pwd)
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.19 (Claude Code)
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
iTerm2
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗