[BUG] Incorrect relative path calculation for @ file reference
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?
When using @ to reference a file that exists within the current
working directory, Claude Code displays an incorrect relative
path with unnecessary ../../../ prefixes, pointing to a
non-existent location.
Environment:
- Working directory: /Users/jack/my-tools/c
laude-code/support-stack
- File location: /Users/jack/claud
e-code/support-stack/dotnet-service/Intra/ArtemisAgent.cs
Expected behavior:
The @ reference should display:
dotnet-service/Intra/ArtemisAgent.cs
Actual behavior:
The @ reference displays:
../../../dotnet-service/Intra/ArtemisAgent.cs
This incorrectly suggests the file is located at /Users/jack/dotnet-service/Intra/ArtemisAgent.cs, which
does not exist.
Settings (~/.claude/settings.json):
{
"filesystem": {
"searchUpward": false
},
"autocomplete": {
"useCwdOnly": true,
"respectProjectRoot": false
}
}
Notes:
- The file exists and is accessible in the current working
directory
- The settings explicitly disable upward directory search
- The path calculation seems to be using an incorrect base
directory
What Should Happen?
Expected behavior:
The @ reference should display:
dotnet-service/Intra/ArtemisAgent.cs
Error Messages/Logs
Steps to Reproduce
When using @ to reference a file that exists within the current
working directory, Claude Code displays an incorrect relative
path with unnecessary ../../../ prefixes, pointing to a
non-existent location.
Environment:
- Working directory: /Users/jack/my-tools/c
laude-code/support-stack
- File location: /Users/jack/claud
e-code/support-stack/dotnet-service/Intra/ArtemisAgent.cs
Claude Model
None
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.19
Platform
Other
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗