claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

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

Open jxonas opened this issue 11 months ago โ€ข 15 comments

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/

  2. Docker container with:

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

jxonas avatar Dec 18 '25 02:12 jxonas

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

github-actions[bot] avatar Dec 18 '25 02:12 github-actions[bot]

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.

erichaase avatar Dec 18 '25 03:12 erichaase

I have same problem.

yanyang1116 avatar Dec 18 '25 16:12 yanyang1116

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

amorozqua avatar Dec 19 '25 14:12 amorozqua

Still a problem in 2.0.74 =/

jxonas avatar Dec 20 '25 00:12 jxonas

This issue also exist in MacOS.

andersrennermalm avatar Dec 21 '25 09:12 andersrennermalm

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

oksktank avatar Dec 29 '25 07:12 oksktank

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

theharshpat avatar Jan 07 '26 14:01 theharshpat

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

ricardo-eai avatar Jan 07 '26 21:01 ricardo-eai

Still happening on 2.1.1

emanuelturis avatar Jan 08 '26 17:01 emanuelturis

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

fatihaziz avatar Jan 09 '26 17:01 fatihaziz

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

duckSquirrelPilot avatar Jan 14 '26 20:01 duckSquirrelPilot

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"
  },

polyrand avatar Jan 14 '26 21:01 polyrand

@claude please fix

jeremyjbarth avatar Jan 14 '26 21:01 jeremyjbarth

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.

polyrand avatar Jan 14 '26 21:01 polyrand

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

steve9001 avatar Jan 18 '26 17:01 steve9001

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

tacass avatar Jan 19 '26 20:01 tacass

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.

LeamHall avatar Jan 21 '26 13:01 LeamHall

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.

iliaparvanov avatar Jan 22 '26 09:01 iliaparvanov

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

annoing-morda avatar Jan 23 '26 10:01 annoing-morda