claude-code - 💡(How to fix) Fix [BUG] Claude doesn't know in what directory it was opened, leading to reading files from generic path: /home/user/... [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#46933Fetched 2026-04-12 13:29:21
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
labeled ×3

Error Message

Error Messages/Logs

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

As can be seen in the picture below, a new conversation (in SIMPLE mode), asking a simple question just for the repro - leading Claude to read some files from the repo.

The problem is that Claude doesn't know where it was opened in, in this case: ~/repos/some-api. Instead, Claude tries to ls files on: /home/user leading to read permission request.

Only when Claude learns what is the working directory, then it continues to work properly.

<img width="590" height="233" alt="Image" src="https://github.com/user-attachments/assets/019d35a8-17cc-411d-a1ee-766f40cefc10" />
  1. I tried reverting back to an older version (v.92) which still has this issue.
  2. It happens on the latest version too (v.104).
  3. My work computer has Claude with (v.92) which does not suffer from this behavior (this is why I reverted back to this version on the problematic computer)
  4. I tried SIMPLE mode too, still happens (CLAUDE_CODE_SIMPLE=1), still did not help.
  5. I reviewed my CLAUDE.md file - the issue is not there.

What Should Happen?

Claude should be aware of the working directory, and avoid going out of it for simple tasks such as in the picture. The PWD is specified in the system prompt.

Error Messages/Logs

Steps to Reproduce

as in the picture.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.104

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Other

Additional Information

No response

extent analysis

TL;DR

Claude may need a configuration or environment variable adjustment to recognize the working directory correctly.

Guidance

  • Verify that the PWD environment variable is set and accessible to Claude, as it is specified in the system prompt.
  • Check if there are any differences in the system configuration or environment variables between the working computer (with v.92) and the problematic computer.
  • Investigate if the CLAUDE_CODE_SIMPLE=1 mode has any specific requirements or limitations that might be contributing to the issue.
  • Review the documentation for the Anthropic API and Claude Code to see if there are any specific settings or configurations required for the working directory to be recognized.

Notes

The issue seems to be related to the working directory not being recognized by Claude, but the exact cause is unclear. Further investigation into the system configuration and environment variables is needed to determine the root cause.

Recommendation

Apply workaround: Adjust the configuration or environment variables to ensure Claude recognizes the working directory correctly, as the issue is not resolved by reverting to an older version or using the SIMPLE mode.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING