[Bug] Bash parser shows spurious directory access prompts when command analysis fails

Resolved 💬 3 comments Opened Feb 2, 2026 by Crazytieguy Closed Feb 5, 2026

Bug Description
When Claude Code's bash parser can't fully analyze a command, it sometimes shows an "always allow access to [directory]" prompt even though directory access isn't the issue. Selecting the "always allow" option doesn't persist - the same prompt appears again on the next command. The directory is already accessible for other commands (grep, head, etc. work fine), making this extra confusing.

Reproduction 1: Standalone command not in allow list

With Bash(sed *) NOT in the allow list:

  1. Run sed -n '1p' README.md
  2. Prompt appears with "Yes, and always allow access to project/ from this project" option
  3. Select the always allow option → command runs
  4. Run sed -n '1p' README.md (same command)
  5. Prompt appears without the "always allow" option (generic yes/no only)

The directory access prompt was wrong - the actual issue was sed not being in the allow list.

Reproduction 2: For loop with allowed command in body

With Bash(sed *) in the allow list:

  1. Run:

``
for f in README.md
do
sed -n '1p' "$f"
done
``

  1. Prompt appears with "Yes, and always allow access to project/ from this project" option
  2. Select the always allow option → command runs
  3. Run the exact same command again
  4. Same exact prompt appears again

This affects for loops with wc, head, awk, sed, sort, cut, file, diff in the body.

Reproduction 3: rm + glob

  1. Create test files: touch ./test-1.txt ./test-2.txt
  2. Run rm ./test-*.txt
  3. Prompt appears with "Yes, and always allow access to project/ from this project" option
  4. Select the always allow option → files deleted
  5. Create files again and run the same rm command
  6. Same exact prompt appears again

Expected behavior

If the parser can't determine what permission to offer, it should show a generic yes/no prompt without a spurious "always allow" option. For loops containing allowed commands in the body should either be allowed or fail for the correct reason.

Environment Info

  • Platform: darwin
  • Terminal: WezTerm
  • Version: 2.1.29
  • Feedback ID: d065e5eb-a5dd-4c3f-9225-172137e0847a

Errors

[{"error":"Error: String not found in file. Failed to apply edit.\n    at $kT (/$bunfs/root/claude:1463:731)\n    at iCR (/$bunfs/root/claude:1463:107)\n    at HWB (/$bunfs/root/claude:2153:123)\n    at Se_ (/$bunfs/root/claude:1682:2302)\n    at i$ (/$bunfs/root/claude:672:20681)\n    at wq (/$bunfs/root/claude:672:38949)\n    at Mt (/$bunfs/root/claude:672:49471)\n    at cj (/$bunfs/root/claude:672:85493)\n    at dt (/$bunfs/root/claude:672:84475)\n    at im (/$bunfs/root/claude:672:84301)","timestamp":"2026-02-02T04:58:44.182Z"},{"error":"Error: String not found in file. Failed to apply edit.\n    at $kT (/$bunfs/root/claude:1463:731)\n    at iCR (/$bunfs/root/claude:1463:107)\n    at HWB (/$bunfs/root/claude:2153:123)\n    at Se_ (/$bunfs/root/claude:1682:2302)\n    at i$ (/$bunfs/root/claude:672:20681)\n    at wq (/$bunfs/root/claude:672:38949)\n    at Mt (/$bunfs/root/claude:672:49471)\n    at cj (/$bunfs/root/claude:672:85493)\n    at dt (/$bunfs/root/claude:672:84475)\n    at im (/$bunfs/root/claude:672:84301)","timestamp":"2026-02-02T05:00:06.550Z"},{"error":"Error: String not found in file. Failed to apply edit.\n    at $kT (/$bunfs/root/claude:1463:731)\n    at iCR (/$bunfs/root/claude:1463:107)\n    at HWB (/$bunfs/root/claude:2153:123)\n    at Se_ (/$bunfs/root/claude:1682:2302)\n    at i$ (/$bunfs/root/claude:672:20681)\n    at wq (/$bunfs/root/claude:672:38949)\n    at Mt (/$bunfs/root/claude:672:49471)\n    at cj (/$bunfs/root/claude:672:85493)\n    at dt (/$bunfs/root/claude:672:84475)\n    at im (/$bunfs/root/claude:672:84301)","timestamp":"2026-02-02T05:00:08.316Z"},{"error":"Error: String not found in file. Failed to apply edit.\n    at $kT (/$bunfs/root/claude:1463:731)\n    at iCR (/$bunfs/root/claude:1463:107)\n    at HWB (/$bunfs/root/claude:2153:123)\n    at Se_ (/$bunfs/root/claude:1682:2302)\n    at i$ (/$bunfs/root/claude:672:20681)\n    at wq (/$bunfs/root/claude:672:38949)\n    at Mt (/$bunfs/root/claude:672:49471)\n    at cj (/$bunfs/root/claude:672:85493)\n    at dt (/$bunfs/root/claude:672:84475)\n    at im (/$bunfs/root/claude:672:84301)","timestamp":"2026-02-02T05:00:16.728Z"},{"error":"Error: String not found in file. Failed to apply edit.\n    at $kT (/$bunfs/root/claude:1463:731)\n    at iCR (/$bunfs/root/claude:1463:107)\n    at HWB (/$bunfs/root/claude:2153:123)\n    at Se_ (/$bunfs/root/claude:1682:2302)\n    at i$ (/$bunfs/root/claude:672:20681)\n…

Note: Content was truncated.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗