Background task fails with EPERM when user lacks write access to drive root

Resolved 💬 5 comments Opened Dec 16, 2025 by davidrimshnick Closed Feb 14, 2026

Description

Running a background task fails with EPERM: operation not permitted when Claude Code attempts to create a temp directory at the drive root (e.g., H:\tmp). This happens when the user lacks write permissions to the drive root, which is common on:

  • Network/mapped drives
  • System drives without admin privileges

Root Cause

Claude Code appears to be creating a temp directory at {drive_root}/tmp instead of using the system temp directory (%TEMP% / os.tmpdir()).

Error Message

EPERM: operation not permitted, mkdir 'H:\tmp'
    path: "H:\tmp",
 syscall: "mkdir",
   errno: -1,
    code: "EPERM"

      at iJD (B:/~BUN/root/claude.exe:904:8578)
      at mg (B:/~BUN/root/claude.exe:904:9299)
      at spawn (B:/~BUN/root/claude.exe:1507:708)
      at spawn (B:/~BUN/root/claude.exe:1507:1079)
      at K (B:/~BUN/root/claude.exe:3476:20268)
      at K (B:/~BUN/root/claude.exe:3476:20447)
      at Y (B:/~BUN/root/claude.exe:3476:20464)
      at Z (B:/~BUN/root/claude.exe:3476:20535)
      at <anonymous> (B:/~BUN/root/claude.exe:2836:21583)

Steps to Reproduce

  1. Set working directory to a drive where you lack root write permissions (e.g., mapped network drive H:\, or C:\ without admin)
  2. Run any command with run_in_background: true (or move a task to background via UI)
  3. Error occurs immediately

Expected Behavior

Background tasks should use the system temp directory (%TEMP% or C:\Users\<user>\AppData\Local\Temp) instead of trying to create a temp folder at the drive root.

Environment

  • OS: Windows (MINGW64_NT-10.0-17763 3.6.5)
  • Platform: win32
  • Working directory: Network mapped drive (H:\) - no write access to drive root

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗