Skip to content

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

Description

@Butanium

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:corebugSomething isn't workinghas reproHas detailed reproduction stepsplatform:linuxIssue specifically occurs on Linux

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions