[BUG] @ path autocomplete broken in v2.0.72 when running from git subdirectory
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?
In v2.0.72, the @ file path autocomplete adds incorrect ../ prefix when running inside a Docker container from a git subdirectory that has its own .claude/ folder. Works correctly on the host and in v2.0.71.
What Should Happen?
@docs/file.md should resolve relative to the working directory containing .claude/, not require @../docs/file.md.
Error Messages/Logs
Steps to Reproduce
Unable to create minimal reproduction. Issue occurs with this setup:
-
Git repo structure: /path/to/repo/ <- git root /path/to/repo/subdir/ <- contains .claude/ folder /path/to/repo/subdir/docs/
-
Docker container with:
- Volume: -v '/path/to/repo:/path/to/repo'
- Workdir: -w '/path/to/repo/subdir'
- Claude Code v2.0.72
-
Run
claude, type@docs/- suggests@../docs/instead
Environment details:
- Works: v2.0.71 in container, v2.0.72 on host
- Breaks: v2.0.72 in container only
- Linux host, eclipse-temurin:25-jdk-noble base image
- User mapped with matching UID/GID
Workaround: Pin to v2.0.71
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.0.71
Claude Code Version
2.0.72
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
No response
Found 3 possible duplicate issues:
- https://github.com/anthropics/claude-code/issues/11902
- https://github.com/anthropics/claude-code/issues/14122
- https://github.com/anthropics/claude-code/issues/14313
This issue will be automatically closed as a duplicate in 3 days.
- If your issue is a duplicate, please close it and ๐ the existing issue instead
- To prevent auto-closure, add a comment or ๐ this comment
๐ค Generated with Claude Code
I am also seeing this, steps to repro:
$ ls -d .git
.git
$ cd pipelines/app/
$ ls Dockerfile
Dockerfile
> claude
* โโโโโโโ * Claude Code v2.0.72
* โโโโโโโโโ * Sonnet 4.5 ยท API Usage Billing
* โโ โโ * ~/repos/<redacted>/pipelines/app
/model to try Opus 4.5. Note: you may need to request access from your cloud provider
>ย @Dockerfile
This autocompletes to @../../Dockerfile.
I have same problem.
The same problem for me:
searching for @Dockerfile in the current dir, but it shows me that it's in the parent dir:
>ย @../Dockerfile
this is not a docker container. it's a host.
$ claude -v 2.0.73 (Claude Code)
Linux Fedora
Still a problem in 2.0.74 =/
This issue also exist in MacOS.
This issue still exists in recent version of claude code (mac silicon)
Having the same issue on MacOS, m3 pro, 2.0.74 in VSCode
I'm also experiencing this (ubuntu). It's very frustrating. Based on other similar bug reports, it's likely related to the location of the .git folder, regardless of Docker
Still happening on 2.1.1
its hardcore that this bug lasted until minor patch.... 2.1.2 still have same issue
wtf how is this still not fixed? I'm beginning to think the vast majority of claude code users don't use @ references.
I think this should definitely get fixed. As a temporary fix, you can use a custom fileSuggestion command to override the default behaviour:
#!/usr/bin/env python3
"""
Minimal file suggestion hook for Claude Code @ autocomplete.
Search for files using simple string matching with ripgrep.
"""
import json
import os
import subprocess
import sys
def main() -> int:
try:
input_data = json.load(sys.stdin)
except json.JSONDecodeError as e:
print(f"Error: Invalid JSON input: {e}", file=sys.stderr)
return 1
query = input_data.get("query", "")
if not query:
return 0
project_dir = os.environ.get("CLAUDE_PROJECT_DIR", ".")
project_dir = os.path.abspath(project_dir)
cmd = f"rg --follow --files | rg -i -F '{query}'"
result = subprocess.run(
cmd,
shell=True,
cwd=project_dir,
capture_output=True,
text=True,
)
for line in result.stdout.splitlines()[:15]:
print(line)
return 0
if __name__ == "__main__":
sys.exit(main())
Then in the claude JSON config:
"fileSuggestion": {
"type": "command",
"command": "python3 ~/.claude/hooks/hook_file_suggestion.py"
},
@claude please fix
Don't want to spam, just in case my previous comment is not clear for some people, I also wrote a lengthier explanation of setting up a custom fileSuggestion command here.
This is driving me crazy. Please fix it as soon as possible.
Still happening in v2.1.12 Ubuntu 24.04; most annoying, thus the annoying me too comment escalating a thumbs-up.
Still happening in Claude Code 2.1.14, Fedora Linux. Using the Opus model Claude wants to search, using Sonnet it prepends but still finds the file without searching. However, repeated testing in the same session may be caching.
Still an issue in v2.1.15, I just wasted an hour trying to figure out why all paths were broken until I stumbled upon this issue.
Reproduced on Linux (Ubuntu 22.04), Claude Code 2.1.17
I'm agree with @jxonas that the issue is about git repo root.
It should be a setting at least: home directory is a git repo root, or a claude project root (where .claude is located) or a current directory. It's useful for monorepo