[BUG] /doctor schema validator rejects exec-form (args[]) hooks added in 2.1.139

Resolved 💬 1 comment Opened May 12, 2026 by pippenz Closed May 17, 2026

What happens

/doctor reports the following error for any hook entry that uses the exec-form args: string[] field (introduced in v2.1.139) without also setting a legacy command string:

Settings (<path>/settings.json › hooks.PreToolUse.0.hooks.0.command):
  Expected string, but received undefined

The validator still requires command as a string even when args is present. The runtime correctly accepts and executes the exec form, so /doctor's schema check has fallen out of sync with the runtime and the v2.1.139 changelog entry.

Expected behavior

/doctor should accept a {type: "command", args: [...]} hook entry as valid — either by treating command as optional when args is present, or by validating args as an alternative.

Minimal repro

~/.claude/settings.json:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          { "type": "command", "args": ["echo", "hi"], "timeout": 1000 }
        ]
      }
    ]
  }
}

Run /doctor — get command: Expected string, but received undefined.

Evidence the runtime accepts this form

From a live session transcript (~/.claude/projects/<flat>/<session>.jsonl):

{
  "attachment": {
    "type": "hook_success",
    "hookName": "PreToolUse:Bash",
    "hookEvent": "PreToolUse",
    "exitCode": 0,
    "durationMs": 12
  },
  "version": "2.1.139"
}

The hook fires, exits 0, and returns the expected JSON — matching the v2.1.139 changelog: "Added hook args: string[] field (exec form) that spawns the command directly without a shell, so path placeholders never need quoting."

Related

  • #58119 — docs gap for the same args field. Distinct from this report (that one is purely about the hooks reference page).

Environment

  • Claude Code 2.1.139
  • Linux x86_64

View original on GitHub ↗

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