claude-code - 💡(How to fix) Fix [Bug] grep shim misdirection causes agents to bypass permission allowlist with absolute paths [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#56389Fetched 2026-05-06 06:29:24
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
labeled ×4

Error Message

[{"error":"Error: NON-FATAL: Lock acquisition failed for /Users/rugheid/.local/share/claude/versions/2.1.128 (expected in multi-process scenarios)\n at Nq6 (/$bunfs/root/src/entrypoints/cli.js:2764:2177)\n at uGH (/$bunfs/root/src/entrypoints/cli.js:2764:1257)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-05-05T12:26:49.162Z"},{"error":"Error: Failed to fetch version from https://downloads.claude.ai/claude-code-releases/latest: timeout of 30000ms exceeded\n at yP5 (/$bunfs/root/src/entrypoints/cli.js:2762:5605)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-05-05T16:56:44.815Z"},{"error":"Error: Failed to fetch version from https://downloads.claude.ai/claude-code-releases/latest: timeout of 30000ms exceeded\n at yP5 (/$bunfs/root/src/entrypoints/cli.js:2762:5605)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-05-05T16:56:44.816Z"},{"error":"AxiosError: timeout of 5000ms exceeded\n at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:120:13305)\n at emit (node:events:92:22)\n at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:119:3321)\n at request (/$bunfs/root/src/entrypoints/cli.js:122:2467)\n at async As6 (/$bunfs/root/src/entrypoints/cli.js:447:4799)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-05-05T17:10:31.968Z"}]

Code Example

[{"error":"Error: NON-FATAL: Lock acquisition failed for /Users/rugheid/.local/share/claude/versions/2.1.128 (expected in multi-process scenarios)\n    at Nq6 (/$bunfs/root/src/entrypoints/cli.js:2764:2177)\n    at uGH (/$bunfs/root/src/entrypoints/cli.js:2764:1257)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-05T12:26:49.162Z"},{"error":"Error: Failed to fetch version from https://downloads.claude.ai/claude-code-releases/latest: timeout of 30000ms exceeded\n    at yP5 (/$bunfs/root/src/entrypoints/cli.js:2762:5605)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-05T16:56:44.815Z"},{"error":"Error: Failed to fetch version from https://downloads.claude.ai/claude-code-releases/latest: timeout of 30000ms exceeded\n    at yP5 (/$bunfs/root/src/entrypoints/cli.js:2762:5605)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-05T16:56:44.816Z"},{"error":"AxiosError: timeout of 5000ms exceeded\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:120:13305)\n    at emit (node:events:92:22)\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:119:3321)\n    at request (/$bunfs/root/src/entrypoints/cli.js:122:2467)\n    at async As6 (/$bunfs/root/src/entrypoints/cli.js:447:4799)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-05T17:10:31.968Z"}]
RAW_BUFFERClick to expand / collapse

Bug Description Title: grep shim errors push agents toward absolute paths, bypassing permission allowlist

Body:

  • CC injects grep shell function routing to bundled ugrep
  • ugrep diverges from GNU on some flags → confusing errors mentioning "ugrep"
  • Agents misdiagnose as user shell misconfig, retry with /usr/bin/grep or command grep
  • Those paths don't match grep permission rule → either prompt user (friction) or, worse, succeed under broader rules and silently sidestep the intended policy
  • Result: permission model leaks through a tool agents are nudged to invoke
  • Asks: a. Permission matcher should treat grep, /usr/bin/grep, command grep as same tool b. Or: opt-out for the shim c. Or: error messages stay branded as grep so agents don't pivot

Environment Info

  • Platform: darwin
  • Terminal: kitty
  • Version: 2.1.128
  • Feedback ID: 55a7523e-f567-41c0-b81e-96aa44076b0b

Errors

[{"error":"Error: NON-FATAL: Lock acquisition failed for /Users/rugheid/.local/share/claude/versions/2.1.128 (expected in multi-process scenarios)\n    at Nq6 (/$bunfs/root/src/entrypoints/cli.js:2764:2177)\n    at uGH (/$bunfs/root/src/entrypoints/cli.js:2764:1257)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-05T12:26:49.162Z"},{"error":"Error: Failed to fetch version from https://downloads.claude.ai/claude-code-releases/latest: timeout of 30000ms exceeded\n    at yP5 (/$bunfs/root/src/entrypoints/cli.js:2762:5605)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-05T16:56:44.815Z"},{"error":"Error: Failed to fetch version from https://downloads.claude.ai/claude-code-releases/latest: timeout of 30000ms exceeded\n    at yP5 (/$bunfs/root/src/entrypoints/cli.js:2762:5605)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-05T16:56:44.816Z"},{"error":"AxiosError: timeout of 5000ms exceeded\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:120:13305)\n    at emit (node:events:92:22)\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:119:3321)\n    at request (/$bunfs/root/src/entrypoints/cli.js:122:2467)\n    at async As6 (/$bunfs/root/src/entrypoints/cli.js:447:4799)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-05T17:10:31.968Z"}]

extent analysis

TL;DR

The issue can be addressed by treating grep, /usr/bin/grep, and command grep as the same tool in the permission matcher to prevent agents from bypassing the intended policy.

Guidance

  • Review the permission matcher configuration to ensure it handles different grep commands uniformly.
  • Consider implementing an opt-out mechanism for the grep shim to prevent agents from pivoting to alternative grep commands.
  • Verify that error messages are branded consistently as grep to avoid confusing agents and causing them to switch to different grep commands.
  • Investigate the feasibility of updating the ugrep implementation to align more closely with GNU grep behavior and flag handling.

Notes

The provided error logs do not directly relate to the grep shim issue but indicate other problems with the application, such as lock acquisition failures and timeouts. Addressing these issues may also be necessary to ensure the overall stability of the system.

Recommendation

Apply a workaround by treating grep, /usr/bin/grep, and command grep as the same tool in the permission matcher, as this directly addresses the described issue and prevents policy bypasses.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [Bug] grep shim misdirection causes agents to bypass permission allowlist with absolute paths [1 participants]