[BUG] Glob fails silently with Windows absolute paths containing wildcards
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 an absolute Windows path with backslashes is used in the pattern parameter along with wildcards.
When running:
Glob(pattern: "C:\ExampleFolder\*.csv")
The tool returns "No files found" even when CSV files exist in that directory. No error message or guidance is provided to explain why the pattern failed.
The issue appears to be that:
- Backslashes in Windows paths are interpreted as escape characters in the pattern
- Absolute paths mixed with wildcards in the pattern parameter don't work as expected
- The tool provides no feedback that the pattern syntax is incorrect
What Should Happen?
The tool should detect absolute Windows paths and automatically separate the path from the pattern:
Input: Glob(pattern: "C:\ExampleFolder\*.csv")
Auto-convert to: Glob(pattern="*.csv", path="C:\ExampleFolder")
Result: Successfully find files
OR
Convert Windows backslashes to forward slashes automatically: C:\path\*.csv → C:/path/*.csv
At minimum, the tool should not silently fail when given what appears to be a valid pattern.
Error Messages/Logs
Even though files matching the pattern exist in the specified directory, no error messages are displayed. The tool simply returns:
No files found
Steps to Reproduce
- Create test files:
mkdir -p C:\Users\[YourUsername]\Documents\TestDir
echo "test" > C:\Users\[YourUsername]\Documents\TestDir\file1.csv
echo "test" > C:\Users\[YourUsername]\Documents\TestDir\file2.csv
- Try to find files using absolute Windows path with wildcard:
Glob(pattern: "C:\Users\[YourUsername]\Documents\TestDir\*.csv")
- Result: Returns "No files found" (incorrect)
- Use the workaround with relative pattern:
cd C:\Users\[YourUsername]\Documents\TestDir
Glob(pattern: "**/*.csv")
- Result: Successfully finds both CSV files (correct)
- Use the workaround with separated path parameter:
Glob(pattern: "*.csv", path: "C:\Users\[YourUsername]\Documents\TestDir")
- Result: Successfully finds both CSV files (correct)
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
N/A
Claude Code Version
2.0.27 (Claude Code)
Platform
Other
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
Context
This issue was discovered while attempting to search for .CSV files in a Windows directory. Multiple attempts with absolute paths failed silently before CC discovered the relative pattern workaround.
Related Issues
- #10245 - This is a concrete example of poor error messages in file tools. The issue mentions that Glob is "likely affected but not yet tested" - this confirms it.
- #10289 - Claims "Glob and Grep support all path formats" but this appears to only be true when using the path parameter correctly, not when mixing absolute paths with wildcards in the pattern parameter.
Impact
- AI assistant (Claude) made the same mistake 3 times before finding the workaround, wasting API calls
- Intuitive syntax that works in Windows Explorer, PowerShell, and CMD fails silently
- No discoverability of the correct syntax without reading implementation details
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗