[BUG] Claude Code inserts extra character into username when constructing ~/.claude/plans/ path
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Claude Code incorrectly constructs file paths by inserting an extra character into my macOS username, causing all plan file writes to fail with a permission error.
Correct username: user123udo (anonymized — ends in udo)
Claude Code constructs: user123undo with an extra n inserted before do
The cwd passed to each tool call is correct, but when Claude Code constructs the plans directory path independently — e.g. for the Write tool targeting ~/.claude/plans/ — it uses the wrong username.
Environment:
Claude Code version: 2.1.84–2.1.86 (reproducible across versions)
macOS
$HOME, $USER, whoami, and dscl RealName all return the correct username
Workaround:
None — plan files cannot be written, causing plan mode to silently fail every session.
What Should Happen?
Claude should be able to get and use the correct path when creating plan.md files
Error Messages/Logs
Error:
Write(/Users/<wrong-username>/.claude/plans/some-plan.md)
Error: EACCES: permission denied, mkdir '/Users/<wrong-username>'
Root cause hypothesis:
Claude Code derives the plans path from a source other than $HOME or cwd — possibly from the account display name, a cached value, or a separate username lookup that mangles the name. Environment variables $HOME, $USER, whoami, and dscl RealName all return the correct username.
Steps to Reproduce
Steps to reproduce:
macOS username containing a specific character sequence (details withheld for privacy)
Open Claude Code in any project
Trigger any task that causes plan file creation (plan mode)
Observe EACCES: permission denied, mkdir '/Users/<wrong-username>'
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.84–2.1.86 (reproducible across versions)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗