Bash commands written to settings.local.json permissions instead of executing

Resolved 💬 2 comments Opened Feb 2, 2026 by georgesamuelson Closed Mar 2, 2026

Claude Code Bug Report: Bash Commands Serialized as Permission Entries

Ready to submit at: https://github.com/anthropics/claude-code/issues/new

---

Title

Bash commands written to settings.local.json permissions instead of executing

Body

Summary

During a session with apparent memory pressure, Claude Code wrote the full text of bash commands (including a multi-line gh issue create command) into settings.local.json as permission entries instead of executing them. This corrupted the settings file and prevented Claude Code from starting.

Claude Code Version: 2.1.29
Platform: macOS Darwin 25.2.0

What Happened

Session 120 in georgesamuelson-com-website was attempting to run gh issue create to file bug #22462. Instead of executing the command, the session serialized the entire command (including heredoc body) as a permission entry in .claude/settings.local.json.

Corrupted Entries Found

Two malformed permission entries were discovered:

  1. Partial git commit message — A git commit command's heredoc content appeared as a permission
  2. Full gh issue create command — The entire bug report (50+ lines of markdown) was written as a single permission string

Error on Startup

Settings Error

/Users/georgesamuelson/Projects/georgesamuelson-com-website/.claude/settings.local.json
 └ permissions
   └ allow
     └ "Bash(gh issue create --repo anthropics/claude-code --title "sessions-index
       └ json not updated - claude -c fails to find sessions" --body "$\(cat << ''EOF''
         ...

The :* pattern must be at the end. Move :* to the end for prefix matching...

Root Cause Hypothesis

The session confused "record permission for command" with "permission content is the command text". Instead of:

  1. Recording Bash(gh:*) as permission
  2. Executing gh issue create ...

It did:

  1. Recorded the literal command text as the permission entry

This may be related to memory pressure or context overflow during the session.

Impact

  • Settings file corrupted — Claude Code refused to start
  • Data not lost — Manual edit of settings.local.json fixed it
  • Workaround — Remove malformed permission entries from JSON

Related

This occurred while attempting to file bug #22462 (sessions-index.json not updating). That bug was successfully filed in Session 119 before this corruption occurred.

Environment

  • macOS Darwin 25.2.0
  • Claude Code 2.1.29
  • Ghostty terminal
  • Heavy session (459+ messages before corruption)

View original on GitHub ↗

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