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

[BUG] Glob tool silently fails with absolute paths (macOS - cross-platform issue)

Open alexeyv opened this issue 1 month ago • 2 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?

Glob fails silently when using absolute paths with wildcards in the pattern parameter on macOS. This is the same issue as #10337 (Windows), proving it's not a Windows-specific backslash escaping problem - it's a cross-platform bug in how Glob handles absolute paths.

Working directory: /Users/alex/src/afk File exists: /Users/alex/src/afk/docs/analysis/product-brief-afk-2025-12-09.md

Glob("/Users/alex/src/afk/docs/analysis/brief.md") → "No files found" Glob("docs/analysis/brief.md") → finds the file

What Should Happen?

Either:

  1. Absolute paths should work in the pattern parameter, OR
  2. The tool should return an error/warning explaining that only relative paths are supported

Silent failure is the worst outcome - agents make incorrect decisions based on incomplete information.

Error Messages/Logs

No files found

  No error, no warning. Just empty results.

Steps to Reproduce

  1. Have a file at an absolute path, e.g. /Users/alex/src/project/docs/file.md
  2. Working directory is /Users/alex/src/project
  3. Run: Glob("/Users/alex/src/project/docs/*.md") → Returns "No files found"
  4. Run: Glob("docs/*.md") → Successfully finds the file

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.0.62 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Impact

In my case, a workflow missed an existing product brief document and incorrectly reported a "greenfield project" with zero input documents. The agent proceeded with wrong assumptions because Glob silently returned empty results.

Related Issues

  • #10337 - Same bug on Windows. That issue assumes backslash escaping is the cause, but this macOS reproduction proves it's a fundamental issue with absolute paths, not Windows-specific escaping.

alexeyv avatar Dec 09 '25 19:12 alexeyv

Found 1 possible duplicate issue:

  1. https://github.com/anthropics/claude-code/issues/10337

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 09 '25 19:12 github-actions[bot]

I can confirm, it doesn't work on MacOS (newest 2.0.62 (Claude Code)). I had few files and none of them was found using:

⏺ Search(pattern: "/Users/developer/Projects2/system/docs/migration_*_howto.md") ⎿  Found 0 files

⏺ Search(pattern: "/Users/developer/Projects2/system/docs/howto.md") ⎿  Found 0 files

Claude had to try once more with following:

⏺ Bash(ls -la /Users/developer/Projects2/system/docs/*.md 2>/dev/null | head -20)

So in the end it achieves goal, but wastes time, context and credits at the same time

For me this is like "one million dollar" waste due to "thank you" prompt problem

I guess wildcard can't be in the middle of filename. Wildcard is treated as token, not a part of filename. I guess ? doesn't work either. Looks like regression, due to missing unit tests.

aleksadvaisly avatar Dec 10 '25 01:12 aleksadvaisly

I can confirm on linux too.

● Search(pattern: "**/*epic*")
  ⎿  Found 8 files (ctrl+o to expand)

● Search(pattern: "**/epics/**")
  ⎿  Found 12 files (ctrl+o to expand)

● Search(pattern: "**/epic*.md", path: "~/projects/redacted")
  ⎿  Found 7 files (ctrl+o to expand)

● Search(pattern: "**/epics/**/*.md", path: "~/projects/redacted")
  ⎿  Found 12 files (ctrl+o to expand)

● Search(pattern: "/home/nocloud/projects/redacted/**/epic*.md")
  ⎿  Found 0 files 

● Search(pattern: "/home/nocloud/projects/redacted/**/*epic*.md")
  ⎿  Found 0 files 

● Search(pattern: "/home/nocloud/projects/redacted/docs/**/*.md")
  ⎿  Found 0 files 

n0cloud avatar Dec 10 '25 05:12 n0cloud