[BUG] "Don't Ask Again" Overwrites Entire Permissions Array

Status Closed — not planned
Maintainer reply None cached
Activity 13 comments · opened Aug 13, 2025 · closed Jan 15, 2026

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

  1. Have multiple permissions in .claude/settings.local.json:

``json
{
"permissions": {
"allow": [
"Bash(npm install:*)",
"Bash(npm run dev:*)",
"Bash(git status:*)"
]
}
}
``

  1. Run a new command that triggers a permission prompt (e.g., npx tsc)
  2. Click "Don't ask again"
  3. Check .claude/settings.local.json
  4. The file now contains only:

``json
{
"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:

  1. Read the current permissions array
  2. Add the new permission if it doesn't exist
  3. 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.

View original on GitHub ↗

13 Comments

chilts · 11 months ago

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.json file is checked in to git, so I just git checkout .claude/settings.local.json regularly, 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 the permissions.allow array 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.allow to 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 · 11 months ago

Yeah this is a very annoying issue.

BR4096 · 10 months ago

This claude-settings.json corruption started to occur in v2.0.12 (Claude Code) MacOS earlier today each time the file was read.

Nihileon · 10 months ago

same issue here in Current version: 2.0.20

k2iuh · 10 months ago

Same for me on 2.0.22 and MacOS 26. This is so annoying.

arnonmoscona · 9 months ago

Detailed Investigation Report: Permissions Ignored Despite Explicit Configuration

### Environment

  • Claude Code Version: 2.0.34
  • Platform: macOS (Darwin 22.6.0)
  • Project: Local project with .claude/settings.local.json

### Problem Statement
Claude Code repeatedly requests permissions for actions explicitly allowed in .claude/settings.local.json, including:

  • Bash commands: uv run ruff check, uv run ruff format, uv run python -m py_compile
  • MCP tools: mcp__basic-memory__edit_note, mcp__basic-memory__write_note, etc.

All of these permissions were explicitly listed in the permissions.allow array.

### 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:
```
// Before
"Read(/Users/arnon/projects/**)"
"Bash(/Users/arnon/bin/send_text:*)"

// After
"Read(//Users/arnon/projects/**)"
"Bash(//Users/arnon/bin/send_text:*)"

Result: ❌ Failed - Still requested permissions

Test Method: Fresh Claude instance, asked to run uv run ruff check on a file
Outcome: Permission prompt appeared despite pattern being in allow list

Theory 2: Wildcard Syntax Issue (Colon vs Space)

Based on issue #819, we hypothesized that command:* syntax doesn't match space-separated arguments.

Changes Made:
// Before
"Bash(uv run ruff check:*)"
"Bash(uv run ruff format:*)"

// After
"Bash(uv run ruff *)"

Result: ❌ Failed - Still requested permissions

Test Method: New Claude instance after configuration change
Outcome: Still prompted for permission to run uv run ruff check bin/checked_bash.py

Theory 3: Configuration File Corruption

Rolled back .claude/settings.local.json to a known-good version from Oct 27 (commit a079a14) using git.

Result: ❌ Failed - Still requested permissions with old configuration

Test Method: Fresh Claude instance with rolled-back configuration
Outcome: Permissions still requested, ruling out configuration file as the cause

Evidence of Core Bug

  1. MCP Tool Permissions Ignored:
  • Tool mcp__basic-memory__edit_note explicitly listed on line 40 of settings
  • Claude still prompted: "Do you want to proceed? ... for basic-memory - edit_note commands"
  • No wildcards, no paths, exact string match - still failed
  1. Fresh Instance Behavior:
  • Problem occurs in brand new Claude instances running for <10 seconds
  • Rules out issues from #10028 about periodic clearing after hours of use
  • Indicates permission matching is broken at initialization
  1. Pattern Independence:
  • Failed with single slash paths
  • Failed with double slash paths
  • Failed with colon wildcards
  • Failed with space wildcards
  • Failed with exact MCP tool names (no wildcards at all)

Verification Steps Taken

# Verified settings file exists and contains permissions
$ grep -n "edit_note" .claude/settings.local.json
39: "mcp__basic-memory__edit_note",

# Verified only one settings file in project
$ ls -la .claude/settings*.json
-rw-r--r--@ 1 arnon staff 2845 Nov 6 12:09 .claude/settings.local.json

# Tested with git history
$ git log --oneline -- .claude/settings.local.json
ffe4d62 FLO-72: Add customers table page with sortable columns
99fa209 FLO-72: Implement users table page infrastructure
a079a14 FLO-72: prep for implementing table pages

# Rolled back and tested
$ git checkout a079a14 -- .claude/settings.local.json
# Result: Still prompted for permissions

Screenshot Evidence

Permission prompt appeared for uv run ruff check bin/checked_bash.py despite:

  • Settings containing "Bash(uv run ruff check:)" (later changed to "Bash(uv run ruff )")
  • Fresh Claude instance
  • File explicitly shown in working directory

Conclusion

The permission system in Claude Code 2.0.34 does not read or respect .claude/settings.local.json at all, or the pattern matching is completely broken for all pattern types.

This is not caused by:

  • Path format (single vs double slash)
  • Wildcard syntax (colon vs space)
  • Configuration file corruption
  • Duplicate entries
  • Periodic clearing (happens immediately)

This appears to be a fundamental bug in the permission system initialization or matching logic affecting:

  • All Bash command patterns
  • All MCP tool permissions
  • Both wildcard and exact-match patterns

The system prompts for permissions on every fresh instance regardless of configuration, making the settings file effectively non-functional.

Reproducibility

100% reproducible on every fresh Claude Code instance with any configuration pattern tested.
```

arnonmoscona · 9 months ago

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 · 9 months ago

Friends,

Frustrating, indeed. Here is how I have been surviving.

chmod 444 .claude/settings.local.json
chmod 555 .claude

When I start Claude Code, I instruct it to read .claude/settings.local.json.

Warm regards,

Manny

kinglycodes · 9 months ago

Same here and still not fixed

github-actions[bot] · 8 months ago

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 · 8 months ago

So, arrays in settings.local.json are replaced instead of merged/appended?
Note then that the bug also affects additionalDirectories when using /add-dir multiple times.

Workaround

Manually edit .claude/settings.local.json to include all directories.

github-actions[bot] · 7 months ago

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[bot] · 7 months ago

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.