[BUG] ZodError in permission system blocks all tool operations on ~/.claude/agents/

Resolved 💬 1 comment Opened Apr 21, 2026 by stefbonnet7 Closed May 27, 2026

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?

Bug description

All tool operations (Edit, Write, Bash sed) targeting files in ~/.claude/agents/ fail with a ZodError in the permission validation system. The permission request object itself is malformed — the error fires before allow/deny logic is even reached.

This happens despite Bash(*) being explicitly in the allowlist in settings.json.

Error output

Tool permission request failed: ZodError: [
  {
    "code": "invalid_union",
    "errors": [
      [
        {
          "code": "invalid_value",
          "values": ["allow"],
          "path": ["behavior"],
          "message": "Invalid input: expected \"allow\""
        }
      ],
      [
        {
          "code": "invalid_value",
          "values": ["deny"],
          "path": ["behavior"],
          "message": "Invalid input: expected \"deny\""
        },
        {
          "expected": "string",
          "code": "invalid_type",
          "path": ["message"],
          "message": "Invalid input: expected string, received undefined"
        }
      ]
    ],
    "path": [],
    "message": "Invalid input"
  }
]

Expected behavior

The permission system should either allow (per Bash(*)) or prompt the user — not crash with a schema validation error.

Environment

  • Claude Code version: 2.1.37
  • Platform: macOS (Darwin 25.3.0, arm64)
  • Running via: Hyo Obsidian plugin (v0.1.6)
  • ~/.claude/agents/ is under an additionalDirectories parent (~/.claude)
  • Read operations on the same path work fine — only writes are affected

What Should Happen?

The permission system should either allow (per Bash(*)) or prompt the user — not crash with a schema validation error.

Error Messages/Logs

Steps to Reproduce

Steps to reproduce

  1. Have Bash(*) in your settings.json permissions allowlist
  2. Have agent .md files in ~/.claude/agents/ (e.g. for the Hyo Obsidian plugin)
  3. From a Claude Code session with working directory set to an Obsidian vault, try any write operation on that path:
  • Edit tool on ~/.claude/agents/claudine.md
  • Bash with sed -i '' 's/old/new/' ~/.claude/agents/claudine.md
  • Write tool to that path

All fail with the same ZodError.

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.37

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗