Repository navigation
Description
Bug Report: "Don't Ask Again" Overwrites Entire Permissions Array
Description
When clicking "Don't ask again" for a command permission in Claude Code, the entire allow array in .claude/settings.local.json gets replaced with just the new permission, causing all previously saved permissions to be lost.
Expected Behavior
New permissions should be appended to the existing allow array, preserving all previously saved permissions.
Actual Behavior
The entire allow array is replaced with only the new permission, deleting all existing permissions.
Steps to Reproduce
-
Have multiple permissions in
.claude/settings.local.json:{ "permissions": { "allow": [ "Bash(npm install:*)", "Bash(npm run dev:*)", "Bash(git status:*)" ] } } -
Run a new command that triggers a permission prompt (e.g.,
npx tsc) -
Click "Don't ask again"
-
Check
.claude/settings.local.json -
The file now contains only:
{ "permissions": { "allow": [ "Bash(npx tsc:*)" ] } }
Impact
- Users lose all their saved permissions every time they add a new one
- Have to manually restore permissions or re-approve commands repeatedly
- Makes the "Don't ask again" feature counterproductive
Environment
- Claude Code version: [Current version]
- OS: Windows
- Project type: Next.js/TypeScript
Workaround
Created a script to restore permissions:
// restore-permissions.js
const fs = require('fs');
const path = require('path');
const settingsPath = path.join(__dirname, '.claude', 'settings.local.json');
const desiredPermissions = [
"Bash(npm install:*)",
"Bash(npm run dev:*)",
// ... other permissions
];
const currentSettings = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
const currentAllow = currentSettings.permissions?.allow || [];
const mergedPermissions = [...new Set([...desiredPermissions, ...currentAllow])];
currentSettings.permissions.allow = mergedPermissions;
fs.writeFileSync(settingsPath, JSON.stringify(currentSettings, null, 2));Suggested Fix
When adding a new permission, the code should:
- Read the current permissions array
- Add the new permission if it doesn't exist
- Write back the merged array
Example fix:
// Instead of:
settings.permissions.allow = [newPermission];
// Should be:
settings.permissions.allow = [...new Set([...settings.permissions.allow, newPermission])];Additional Context
This happens consistently - observed multiple times in a single session where permissions were overwritten with:
Bash(npx tsc:*)Bash(taskkill:*)Bash(powershell:*)
Each time, all previous permissions were lost.
Activity
chilts commentedon Sep 6, 2025
I am also getting this problem and it is very frustrating. Having to say yes to something I've said yes to already (multiple times now due to this bug) gets unwieldy.
My workaround is that my
.claude/settings.local.jsonfile is checked in to git, so I justgit checkout .claude/settings.local.jsonregularly, usually after I have finished a task and done a/clear. I've also quit claude at this point, re-run it, but still it manages to lose thepermissions.allowarray pretty soon, as @jessicawestbrook says, when it asks again - though I also find it asks for commands that are already allowed, so it probably just disappears upon config read even prior to asking for permission.Just to finish, why not change
permissions.allowto an object (with true values) so that object manipulation such as adding a new permission is much much easier than having to do array manipulation. Ultimately this doesn't matter if it works, but currently it doesn't.DanielHaddon commentedon Sep 12, 2025
Yeah this is a very annoying issue.
BR4096 commentedon Oct 9, 2025
This claude-settings.json corruption started to occur in v2.0.12 (Claude Code) MacOS earlier today each time the file was read.
Nihileon commentedon Oct 16, 2025
same issue here in Current version: 2.0.20
k2iuh commentedon Oct 19, 2025
Same for me on 2.0.22 and MacOS 26. This is so annoying.
arnonmoscona commentedon Nov 6, 2025
Detailed Investigation Report: Permissions Ignored Despite Explicit Configuration
Environment
.claude/settings.local.jsonProblem Statement
Claude Code repeatedly requests permissions for actions explicitly allowed in
.claude/settings.local.json, including:uv run ruff check,uv run ruff format,uv run python -m py_compilemcp__basic-memory__edit_note,mcp__basic-memory__write_note, etc.All of these permissions were explicitly listed in the
permissions.allowarray.Investigation Steps
Theory 1: Path Format Issue (Single vs Double Slash)
Based on issue #6850 and #6881, we hypothesized that absolute paths needed double slashes (
//) on macOS.Changes Made:
arnonmoscona commentedon Nov 6, 2025
This critical security bug has been open for 3 months with no assignee. Permission system is completely non-functional in v2.0.34. Escalating to
security@anthropic.com and support@anthropic.com
MannyPeterson commentedon Nov 8, 2025
Friends,
Frustrating, indeed. Here is how I have been surviving.
When I start Claude Code, I instruct it to read
.claude/settings.local.json.Warm regards,
Manny
kinglycodes commentedon Nov 14, 2025
Same here and still not fixed
github-actions commentedon Dec 15, 2025
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
mousio commentedon Dec 16, 2025
So, arrays in
settings.local.jsonare replaced instead of merged/appended?Note then that the bug also affects
additionalDirectorieswhen using/add-dirmultiple times.Workaround
Manually edit .claude/settings.local.json to include all directories.
github-actions commentedon Jan 15, 2026
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
github-actions commentedon Jan 23, 2026
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.