EINVAL error writing task output files on Windows

Resolved 💬 3 comments Opened Feb 25, 2026 by ssgonell Closed Mar 1, 2026

Bug Description

Background tasks/agents fail with EINVAL: invalid argument when trying to write task output files on Windows.

Error Message

Error: EINVAL: invalid argument, open 'C:\Users\omkco\AppData\Local\Temp\claude\C--Users-omkco-PycharmProjects-scube-quantpy\tasks\bouhwyo9n.output'

Environment

  • OS: Windows 11 Pro 10.0.26200
  • Claude Code version: 2.1.58
  • Shell: bash (Git Bash)

Steps to Reproduce

  1. Open Claude Code on Windows
  2. Run a task that triggers a background agent (e.g., a Bash command via the Task tool)
  3. The task fails with the EINVAL error when Claude Code tries to write the .output file

Troubleshooting Already Attempted

  • The tasks directory exists and is writable (verified manually with Python open()/write())
  • Disk space is not an issue (1.1TB free)
  • Adding a Windows Defender exclusion for the Claude temp directory did not resolve the issue
  • Updated to latest version (2.1.58) — issue persists
  • Error is intermittent and appears across multiple Claude Code sessions

Appears to be an internal Node.js file handle / race condition issue specific to Windows.

View original on GitHub ↗

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