[BUG] Working directory shown in session header does not match actual pwd output

Resolved 💬 2 comments Opened Mar 25, 2026 by 0x7c16 Closed Mar 26, 2026

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?

The working directory displayed in the Claude Code session header is inconsistent with the actual working directory returned by pwd. The header shows a path with a randomly generated username (e.g., /home/rc0hr4/code/doagent, /home/xk2m91/code/doagent — changes every session) while Bash(pwd) consistently returns the correct path (e.g., /home/Machine/code/doagent).

<img width="852" height="130" alt="Image" src="https://github.com/user-attachments/assets/3c8a541a-4786-4eec-9917-7235560a342f" />

Furthermore, this is not just a display issue — file write operations are also affected. Claude Code attempts to write files to the corrupted random path (e.g., Write(/home/rc0hr4/code/doagent/CLAUDE.md)), which either fails or writes to the wrong location entirely, as shown in the screenshot:

<img width="423" height="44" alt="Image" src="https://github.com/user-attachments/assets/5be2e8de-6306-49e8-9d43-220436560fd8" />

This means any file operations performed in an affected session risk being silently misdirected to a non-existent or unintended directory.

What Should Happen?

The working directory displayed in the session header should always match the actual working directory as reported by pwd. Both should consistently show the same path, as demonstrated in the correctly functioning session on the right side of the screenshot.

Error Messages/Logs

Steps to Reproduce

  1. Open Claude Code and set the project directory to a path (e.g., ~/code/doagent)
  2. Start a session — observe the working directory shown in the session header
  3. Run pwd via the Bash tool inside the session
  4. Compare the path shown in the header vs. the output of pwd
  5. In some configurations (e.g., API Usage Billing mode), the header displays a stale or incorrect path (e.g., /home/rc0hr4/code/doagent) that does not match the actual runtime path (/home/Machine/code/doagent)

Additional context:
The issue appears to be specific to sessions using API Usage Billing — sessions running under Claude Pro display the correct path.

The incorrect username segment in the header path (e.g., rc0hr4) is not fixed — it appears to be randomly generated and changes with every new session, suggesting the header is resolving the path in a sandboxed or ephemeral environment rather than the actual runtime context.

Claude Model

Opus

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

v2.1.81

Platform

Other

Operating System

Windows

Terminal/Shell

WSL (Windows Subsystem for Linux)

Additional Information

_No response_

View original on GitHub ↗

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