Unknown commands and unknown subcommands exit 0, so failures read as success to agents branching on exit codes
Summary
Invoking a command that does not exist prints the top-level help and exits 0. Same for an unrecognized subcommand of an existing command, which prints nothing and exits 0. Agents routinely branch on exit status (cmd || fallback), so a typo, a hallucinated command, or drift between docs and implementation is silently reported as a successful operation.
Version: agent-browser 0.38.1, macOS (darwin arm64).
Reproduce
Unknown top-level command:
$ agent-browser addinitscript --help
agent-browser - fast browser automation CLI for AI agents
Usage: agent-browser <command> [args] [options]
…
$ echo $?
0
addinitscript is not implemented, but it is referenced twice in agent-browser skills get core --full, so an agent following the shipped docs lands exactly here. (The working mechanism is the launch flag open --init-script <path>.)
Unknown subcommand — no output at all:
$ agent-browser cookies delete somename --session demo
$ echo $?
0
agent-browser cookies --help lists only get, set, clear. There is no delete, yet the call succeeds silently. An agent clearing an override cookie this way believes it cleared, and proceeds on a false premise — the failure surfaces much later as unexplained page state.
Impact
This is the class of bug that is invisible to humans (who read the output) and maximally harmful to agents (who read exit codes). It also actively rewards guessing: a guessed command that "succeeds" gets recorded as valid usage. I found both of these while auditing agents' command logs — 23 non-zero exits out of 834 commands looked like a healthy error rate, but the silent-success cases are the ones that produced wrong conclusions rather than retries.
Suggested fix
Exit non-zero and write to stderr for unrecognized commands and subcommands, ideally with a did-you-mean. Printing help on misuse is fine; exiting 0 is what breaks callers.
Source: vercel-labs/agent-browser