claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Background tasks ignore $TMPDIR and hardcode /tmp/claude/

Open Butanium opened this issue 2 weeks ago • 9 comments

Description

Claude Code's background task system ignores the $TMPDIR environment variable and hardcodes /tmp/claude/ for task management, causing permission denied errors when /tmp is not writable by the user.

Steps to Reproduce

  1. Have $TMPDIR set to a valid, writable directory (e.g., /run/user/$(id -u))
  2. Ensure /tmp is not writable by the current user
  3. Run a background task in Claude Code (e.g., run_in_background: true on a Bash command)

Expected Behavior

Claude Code should respect $TMPDIR and create its task directory there.

Actual Behavior

Claude Code ignores $TMPDIR and attempts to create /tmp/claude/<workspace-path>/tasks, resulting in:

EACCES: permission denied, mkdir '/tmp/claude/-mnt-nw-home-c-dumas-research-libs-nnsight/tasks'

Environment

  • OS: Linux 6.8.0-60-generic (Ubuntu)
  • TMPDIR: /run/user/2011 (set and valid)
  • Claude Code version: Latest

Notes

This is distinct from existing issues like #10194 (TMPDIR pointing to non-existent directory) and #14799 (EXDEV with tmpfs). In this case, $TMPDIR is correctly set to a valid, writable directory, but Claude Code completely ignores it for the background task system.

Butanium avatar Dec 29 '25 15:12 Butanium