MCP tool result auto-save path does not respect HOME environment variable (non-ASCII username)

Resolved 💬 2 comments Opened Mar 9, 2026 by tokiyama-corp Closed Apr 6, 2026

Description

When an MCP tool result exceeds the maximum token limit, Claude Code automatically saves the output to a temporary file under:

C:\Users\<username>\.claude\projects\<project-id>\tool-results\<filename>.txt

This path uses the actual Windows user profile path (C:\Users\沖山智彦\) rather than the HOME environment variable override.

Context

For users with non-ASCII characters in their Windows username (e.g., Japanese characters), the HOME environment variable workaround (HOME=C:\cchome with a junction to the real profile) was introduced to avoid EEXIST errors in Skill / Write / Edit tools (see #31115, #30903).

However, the MCP tool result auto-save mechanism does not respect this HOME override and still resolves the path via the original user profile directory.

Steps to Reproduce

  1. Windows with a non-ASCII username (e.g., 沖山智彦)
  2. Set HOME=C:\cchome (junction to C:\Users\沖山智彦)
  3. Call an MCP tool that returns a result exceeding the token limit
  4. Observe the auto-saved file path uses C:\Users\沖山智彦\.claude\... instead of C:\cchome\.claude\...

Expected Behavior

The auto-save path should respect the HOME environment variable, consistent with other tools (Skill, Write, Edit).

Actual Behavior

The path resolves to C:\Users\<non-ASCII username>\.claude\projects\..., bypassing the HOME override.

Impact

  • Currently low severity: the file is read-only and temporary, so no EEXIST errors occur
  • Potential risk: if the non-ASCII path causes encoding issues in future operations on these temp files

Environment

  • OS: Windows 11 Pro
  • Claude Code: VSCode extension
  • Related issues: #31115, #30903

View original on GitHub ↗

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