VS Code extension crashes when searching directories containing .claude/settings.local.json with invalid paths
NOTE: There was a real issue when Claude tried to process a file in a specific user's sandbox, but I authorized it to submit the bug report without noticing it had changed the steps in a way that was not reproducible–sorry about that!
Description
The VS Code extension crashes/disconnects when using search tools (Glob, Grep, Read) on directories that contain a .claude/settings.local.json file with invalid paths. The extension appears to load and process settings files from directories being searched through, not just the current working directory.
Steps to Reproduce
- Have a directory structure like:
````
/Users/userA/code/repo/sandbox/userB/.claude/settings.local.json
- The
settings.local.jsoncontains paths that don't exist on your machine:
``json``
{
"permissions": {
"additionalDirectories": ["/Users/userB/Documents"]
},
"enableAllProjectMcpServers": true,
"enabledMcpjsonServers": ["asana"]
}
- From userA's working directory, ask Claude to search for files in userB's sandbox
- Extension crashes with stream disconnection errors
Error Messages
Tool permission request failed: Error: Tool permission stream closed before response received
Tool permission request failed: Error: Stream closed
Expected Behavior
- The extension should only load settings for the current working directory, not for arbitrary directories being searched through
- If it does encounter settings files, it should gracefully handle invalid paths (log a warning, skip the invalid entries) rather than crashing
- Missing
additionalDirectoriespaths should not cause a fatal error
Environment
- VS Code extension
- macOS (Darwin 24.6.0)
- Version: 2.0.59
Workaround
Removing or renaming the .claude folder in the problematic directory allows searches to work:
mv /path/to/problematic/.claude /path/to/problematic/.claude.bak
Additional Context
This was discovered when searching through a monorepo's sandbox directories where different users have their own .claude/settings.local.json files with machine-specific paths.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗