[BUG] ZodError in permission system blocks all tool operations on ~/.claude/agents/
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 anadditionalDirectoriesparent (~/.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
- Have
Bash(*)in yoursettings.jsonpermissions allowlist - Have agent
.mdfiles in~/.claude/agents/(e.g. for the Hyo Obsidian plugin) - From a Claude Code session with working directory set to an Obsidian vault, try any write operation on that path:
Edittool on~/.claude/agents/claudine.mdBashwithsed -i '' 's/old/new/' ~/.claude/agents/claudine.mdWritetool 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_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗