[BUG]
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?
Claude Config corruption
how does this corruption occur?
⏺ Good question! Let me investigate how this corruption happens by looking at
patterns in the corrupted entries:
⏺ Bash(cat /Users/jmw/dev/advisors/.claude/settings.local.json.pre-fix-backup |
jq -r '.permissions.allow[]' | grep ":\*)" | head -30)
⎿ Bash(PGPASSWORD=password psql:*)
Bash(git commit:*)
Bash(git push:*)
… +27 lines (ctrl+o to expand)
⏺ Bash(cat /Users/jmw/dev/advisors/.claude/settings.local.json | jq -r
'.permissions.allow[]' | grep ":" | grep -v "://" | grep -v ":5" | grep "
\*)" | head -20)
⎿ Bash(pnpm test:integration *)
Bash(npm run test:e2e *)
Bash(npm run lint:fix *)
… +11 lines (ctrl+o to expand)
⏺ Bash(cat /Users/jmw/dev/advisors/.claude/settings.local.json.pre-fix-backup |
jq -r '.permissions.allow[]' | grep "test:e2e" )
⎿ Bash(npm run test:e2e *)
Bash(npm run test:e2e:visual *)
Bash(pnpm run test:e2e:capture-auth *)
… +4 lines (ctrl+o to expand)
⏺ Root Cause Analysis
I found it! The corruption happens due to a pattern generation bug when
creating wildcard permissions. Here's the evidence:
The Pattern:
Commands with colons in them get double-corrupted:
# Original command:
pnpm test:e2e
# Correct wildcard pattern:
Bash(pnpm test:e2e *)
# CORRUPTED pattern that was generated:
Bash(pnpm test:e2e:*)
When this happens:
Looking at your file, you have both valid AND corrupted versions of similar
commands:
Valid patterns (correctly approved):
- ✅ Bash(pnpm test:e2e *)
- ✅ Bash(pnpm test:e2e knowledgebase.spec.ts)
- ✅ Bash(npm run test:e2e *)
Corrupted patterns (bug during approval):
- ❌ Bash(pnpm test:e2e:*)
- ❌ Bash(pnpm run lint:*)
- ❌ Bash(git commit:*)
Why this happens:
There are two different code paths in Claude Code for generating permission
patterns:
- Correct path: Properly parses command → adds *) suffix
- Buggy path: Strips the command → adds :*) suffix
The buggy path likely triggers when:
- You approve a command with "always allow similar"
- The permission system tries to generalize the pattern
- Instead of adding a space + wildcard, it appends :*)
This is a Claude Code bug, not user error
You didn't manually create these - they were auto-generated by Claude Code's
permission approval flow. The bug has been inconsistent (some patterns
correct, others corrupted), suggesting it might depend on:
- Which version of Claude Code was running
- How the command was approved (quick approval vs. manual pattern entry)
- The specific code path taken during permission creation
You should report this to the Claude Code team at
https://github.com/anthropics/claude-code/issues with this analysis!
What Should Happen?
It shouldn't do this :-)
Error Messages/Logs
Steps to Reproduce
Unkown, see above.
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.39 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗