Skip to content

[BUG] Using Claude Code with "@reference/" file reference forces a prepend of "@../reference" #19713

Description

@LeamHall

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?

This happened when using Opus, but not Sonnet.

When I try to read a file in the CLI prompt, I start with "@relative_path/to/file", but the prompt changes that to "@../relative_path/to/file", which is not where the file is. Then CC wants to search for the file I just told it the location of.

pwd; ls reference/evaluate_platform_engineering_site.txt 
/usr/local/src/LeamHall/resume/career
reference/evaluate_platform_engineering_site.txt
❯ Please read @reference/eval                                                   
────────────────────────────────────────────────────────────────────────────────
  + ../reference/evaluate_platform_engineering_site.txt  

What Should Happen?

Claude should take a relative path from the current directory.

Error Messages/Logs

❯ Please read @../reference/evaluate_platform_engineering_site.txt              
                                                                                
● Read(/usr/local/src/LeamHall/resume/reference/evaluate_platform_engineering_si
      te.txt)                                                                   
  ⎿  Error reading file                                                         
                                                                                
● The file doesn't exist at that path. Let me search for it.                    
                                                                                
● Search(pattern: "**/*evaluate*platform*", path:                               
        "/usr/local/src/LeamHall/resume")                                       
  ⎿  Interrupted · What should Claude do instead?                               
                                                                                
● Search(pattern: "**/*platform*", path: "/usr/local/src/LeamHall/resume")      
  ⎿  Interrupted · What should Claude do instead?

Steps to Reproduce

In a directory where there is a directory of files to read, with a similar directory name in the parent directory, type:

Please read @research/my_file.txt

So far Claude is prepending "../" so that the prompt is forced to:

Please read @../research/my_file.txt

Claude sees

❯ Please read @reference/                                                 
────────────────────────────────────────────────────────────────────────────────
  + ../reference/evaluate_platform_engineering_site.txt                         
  + ../reference/overview_duckai 

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.14

Platform

Anthropic API

Operating System

Other Linux

Terminal/Shell

Xterm

Additional Information

Oddly, Claude had switched to Opus. When I went back to the Sonnet default it worked.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions