MCP tool result auto-save path does not respect HOME environment variable (non-ASCII username)
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
- Windows with a non-ASCII username (e.g.,
沖山智彦) - Set
HOME=C:\cchome(junction toC:\Users\沖山智彦) - Call an MCP tool that returns a result exceeding the token limit
- Observe the auto-saved file path uses
C:\Users\沖山智彦\.claude\...instead ofC:\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
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗