`-p` mode: `Unknown command` should exit non-zero so automation can detect it
Summary. In print mode, an unresolvable slash command prints Unknown command: /foo:bar to stdout and exits 0. Headless pipelines that dispatch claude -p "/plugin:command" cannot distinguish "command ran" from "command never existed" without scraping stdout.
Repro (2.1.238, macOS):
claude -p "/definitely-not-a-plugin:nope" --max-turns 1; echo $?
# Unknown command: /definitely-not-a-plugin:nope
# 0
Expected. Non-zero exit (e.g. 2, matching conventional usage errors), with the message on stderr rather than stdout. Interactive mode unchanged.
Why it matters. In #76066 every overnight dispatch in an automated pipeline failed silently for ~11 hours because each run "succeeded" with Unknown command as its only output. A non-zero exit would have failed the first job and paged immediately instead of producing a pile of empty results. Any system using -p as a build step has the same blind spot.
Context. Filed at the maintainers' suggestion in #76066 (closing comment).
---
Drafted with Claude Code (AI-assisted); repro run and text reviewed by the author.