[BUG] @ path autocomplete broken in v2.0.72 when running from git subdirectory

Resolved 💬 31 comments Opened Dec 18, 2025 by jxonas Closed May 5, 2026
💡 Likely answer: A maintainer (ashwin-ant, collaborator) responded on this thread — see the highlighted reply below.

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:

  1. Git repo structure:

/path/to/repo/ <- git root
/path/to/repo/subdir/ <- contains .claude/ folder
/path/to/repo/subdir/docs/

  1. Docker container with:
  • Volume: -v '/path/to/repo:/path/to/repo'
  • Workdir: -w '/path/to/repo/subdir'
  • Claude Code v2.0.72
  1. 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_

View original on GitHub ↗

31 Comments

github-actions[bot] · 7 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/11902
  2. https://github.com/anthropics/claude-code/issues/14122
  3. 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

erichaase · 7 months ago

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.

yanyang1116 · 7 months ago

I have same problem.

amorozqua · 6 months ago

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

jxonas · 6 months ago

Still a problem in 2.0.74 =/

andersrennermalm · 6 months ago

This issue also exist in MacOS.

oksktank · 6 months ago

This issue still exists in recent version of claude code (mac silicon)

theharshpat · 6 months ago

Having the same issue on MacOS, m3 pro, 2.0.74 in VSCode

ricardo-eai · 6 months ago

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

emanuelturis · 6 months ago

Still happening on 2.1.1

fatihaziz · 6 months ago

its hardcore that this bug lasted until minor patch.... 2.1.2 still have same issue

duckSquirrelPilot · 6 months ago

wtf how is this still not fixed? I'm beginning to think the vast majority of claude code users don't use @ references.

polyrand · 6 months ago

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"
  },
jeremyjbarth · 6 months ago

@claude please fix

polyrand · 6 months ago

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.

steve9001 · 5 months ago

This is driving me crazy. Please fix it as soon as possible.

tacass · 5 months ago

Still happening in v2.1.12 Ubuntu 24.04; most annoying, thus the annoying me too comment escalating a thumbs-up.

LeamHall · 5 months ago

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.

iliaparvanov · 5 months ago

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.

annoing-morda · 5 months ago

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

JCSnap · 5 months ago

i think a quick fix is just to git init on the root folder, somehow claude code is probably using information from .git for the file search auto complete feature.

suppose we have the following:

.
└── company-repos/
    ├── frontend-app
    ├── backend-app
    ├── service-1
    ├── service-2
    └── service-3

the current bug occurs when each of the subdirectories have their own .git and you are running claude code in company-repos.

The fix is just to git init in company-repos

joalof · 5 months ago

I still have this issue with CC v2.1.20, for me it happens in any simple git repo like this
git-project/
├── subdir

Starting CC in subdir yields incorrect file completions starting with ../ this used to work in Claude 2.072

EddyBuhler · 5 months ago

Same here. Bug still exists in 2.1.23.

sjurado · 5 months ago

Still an issue in 2.1.29

jonathangriffiths · 5 months ago

Time to pop the champagne corks, I think this is now fixed in 2.1.34

JCSnap · 5 months ago

The issue is still happening for me in 2.1.34

dev-mush · 5 months ago

chiming in to say it started happening to me with latest update...I had no issues before, the only thing I did was some tinkering with project files since I moved stuff around, I ave a hunch I might have broken claude's indexing nightmare setup and this is why these things are happening, will try to clean install claude code again and see if the problem persists, if so I think that the issue isn't in the executable but in the ~/.claude/ config files

fatihaziz · 5 months ago

is issue still happen on 2.1.40 too?

ashwin-ant collaborator · 5 months ago

Is this still happening for people?

JCSnap · 5 months ago
Is this still happening for people?

yes its still happening :(

github-actions[bot] · 22 days ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.