CLI dumps 300-line Cliffy Command object on unknown flags / subcommands
Opened by swamp_lord Ā· 4/27/2026Ā· Shipped 4/27/2026
When the CLI rejects an invalid flag or unknown subcommand, the user-friendly message ("Unknown option --inputs. Did you mean option --input?") is buried under ~300 lines / 9 KB of dumped Cliffy Command internals ā circular refs, option/setting/builder maps, the whole framework state. The useful "did you mean" hint is on line 1 and visually lost.
This is specifically the ValidationError path; other input failures (missing required input, malformed JSON, bad YAML, non-existent file) print clean one-line errors as expected.
Steps to reproduce
# Wrong flag name
swamp workflow run namespace-debug --inputs podModel=foo
# ā ValidationError + 309 more lines of Command{} dump
# Wrong short flag
swamp workflow run namespace-debug -i podModel=foo
# ā same
# Unknown flag on method run
swamp model method run challenge-pods get --bogus
# ā same
# Unknown subcommand
swamp workflow describe namespace-debug
# ā sameFor comparison, these stay clean and short:
swamp workflow run namespace-debug(missing required input)swamp workflow run namespace-debug --input 'not-valid-syntax'(bad input format)swamp workflow run namespace-debug --input-file /tmp/missing.yaml(missing file)
Expected
Just the first line ā Unknown option "--inputs". Did you mean option "--input"? ā and exit non-zero. Suppress the cmd: Command {ā¦} payload on ValidationError (or at minimum hide it unless --log debug).
Sample output (truncated)
11:36:06.889 FTL error ValidationError: Unknown option "--inputs". Did you mean option "--input"?
at Command.handleError (https://jsr.io/@cliffy/command/1.0.0/command.ts:2570:11)
at Command.parseCommand (https://jsr.io/@cliffy/command/1.0.0/command.ts:2128:12)
at async file:///var/folders/.../src/cli/mod.ts:1012:7
at async runCli (file:///var/folders/.../src/cli/mod.ts:1004:5)
at async file:///var/folders/.../main.ts:33:5 {
exitCode: 2,
cmd: <ref *1> Command {
cmd: [Circular *1],
parent: <ref *2> Command {
cmd: [Circular *2],
parent: <ref *3> Command { ... },
... another ~280 lines of nested Command objects, settings, options arrays ...
}
}
}Environment
- swamp
20260424.234336.0-sha.0022d1ca - macOS Darwin 22.6.0, zsh
- Output size: 310 lines / 9039 bytes for a single bad flag
Shipped
Click a lifecycle step above to view its details.
Sign in to post a ripple.