[BUG] Regression on 2.1.220: Glob/Grep slash globs anchor to cwd instead of `path` again (#74263, fixed in 2.1.211)

Status Open
Reported on v2.1.210
Maintainer reply None cached
Activity 0 comments · opened Jul 29, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report
  • [x] I am using the latest version of Claude Code

What's Wrong?

This is a regression of #74263, which was closed as completed on 2026-07-21.

That issue's closing comment records the transition precisely:

- Last confirmed: 2.1.210 (built 2026-07-14) - First fixed: 2.1.211 (built 2026-07-15) - Latest verified tested fixed: 2.1.216 (built 2026-07-20)

On 2.1.220 the original behaviour is back. Glob matches its pattern against paths anchored to the shell cwd rather than to the path argument, so any pattern containing a literal directory segment returns No files found whenever the target lives under that cwd. The same call returns the correct files when the target is not under the cwd.

Two symptoms, one cause:

  1. Wrong result set. A pattern with a directory segment silently returns nothing.
  2. Wrong output format. Results come back as paths relative to the shell cwd instead of absolute, so they cannot be fed straight back into Read.

Symptom 1 is the damaging one: a false No files found leads the agent to conclude the file does not exist and proceed on that premise.

Same root cause as the older, also-closed #61420, #43178 and #47042. #61420 was auto-closed as stale with Please open a new issue if this is still relevant, so this report also serves as that refile.

How To Reproduce

Claude Code launched with cwd C:\Users\chris.

1. Create the fixture under the launch cwd.

$t = "C:\Users\chris\qa-glob-test"
New-Item -ItemType Directory -Force -Path "$t\subdir" | Out-Null
1..3 | ForEach-Object { Set-Content "$t\subdir\g0$_.txt" "alvo g0$_" }

2. Confirm the shell cwd.

Bash(command="pwd")     ->  /c/Users/chris

3. Call Glob twice with the same absolute path.

Glob(pattern="subdir/*.txt", path="C:\Users\chris\qa-glob-test")
Glob(pattern="*.txt",        path="C:\Users\chris\qa-glob-test")

Control case. Repeat step 3 with the fixture in a location that is not under the shell cwd (e.g. C:\tmp\qa-glob-test, cwd still /c/Users/chris). Both calls then behave correctly. The only variable is whether the target sits under the cwd.

What Should Happen?

path is absolute and identical in both calls. Both should return the three files, with absolute paths, regardless of where the shell cwd happens to be.

Actual

Glob(pattern="subdir/*.txt", path="C:\Users\chris\qa-glob-test")
->  No files found

Glob(pattern="*.txt", path="C:\Users\chris\qa-glob-test")
->  qa-glob-test\subdir\g01.txt
    qa-glob-test\subdir\g02.txt
    qa-glob-test\subdir\g03.txt

The second call proves the files are there and reachable. The first one, differing only by a literal directory segment in the pattern, returns nothing. The returned paths are relative to C:\Users\chris, not absolute.

Additional note: cd in a Bash call re-triggers it anywhere

The anchor is not only the launch cwd. Because the Bash tool's working directory persists between calls (documented behaviour), a cd in any earlier Bash call moves the anchor and changes Glob results for paths under the new location:

Bash(command="cd /c/Users/chris && pwd")            # target NOT under cwd
Glob(pattern="subdir/*.txt", path="C:\tmp\fx")      ->  3 files, absolute paths

Bash(command="cd /c/tmp && pwd")                    # target now IS under cwd
Glob(pattern="subdir/*.txt", path="C:\tmp\fx")      ->  No files found

Same path, same pattern, same files on disk. This makes the failure intermittent from the operator's point of view: whether a search works depends on where an unrelated earlier command happened to cd.

Separately, Read's error message continued reporting the pre-cd cwd while Read itself resolved relative paths against the post-cd cwd, so at least two notions of cwd are live at once and they disagree.

Grep shows the same path-format behaviour.

Environment

Claude Code : 2.1.220
OS          : Windows 11 Pro 10.0.26200
Shell       : PowerShell 7 and Git Bash
Model       : Claude Opus 5 (1M context)
Date        : 2026-07-29

Reproduced in a clean fixture created from scratch, twice, with the control case above isolating the cwd as the only variable.

View original on GitHub ↗