ErrLookup › Background articles › "unknown output mode", "invalid value for flag", "expects true/false": fixing invalid flag value errors in CLI tools
"unknown output mode", "invalid value for flag", "expects true/false": fixing invalid flag value errors in CLI tools
"unknown output mode", "invalid value for flag", "expects true/false", and similar messages are invalid flag value errors: a CLI accepted your flag but rejected the value because it isn't in the command's whitelist of allowed values (like -o json on a command that only supports -o wide or -o name) or can't be parsed as the flag's type (like yes for a boolean flag). Developers hit these most often when copying flag values between subcommands of the same tool, scripting with unvalidated env variables, or guessing at enum spellings and casing. The fix is almost always to check --help and use an exact, case-sensitive value from the command's accepted set.
Distilled from 98 documented records across 24 repositories.
Background
This family covers errors produced entirely client-side, at flag-parsing or pre-run validation time. Nothing has been executed against a server, cluster, or file system yet — the command compared your value against an allowlist (or a type parser) and stopped before doing real work. That's why tools like argo, cilium/hubble, pulumi, vitess, and golangci-lint can return these errors in milliseconds, and why the fix never involves restarting a daemon or checking connectivity.
The mechanism varies by implementation, and the variation matters for debugging. Some libraries validate at parse time via typed flag values: urfave/cli's BoolFlag Set rejects anything strconv.ParseBool can't read, and its generic wrapper "invalid value %q for flag -%s: %v" nests the underlying parse cause in the trailing %v. Cobra/pflag-based tools (cilium, hubble, pulumi, golangci-lint) run Set hooks during parsing, so a bad --identity or --ip-trace-id aborts parsing with a wrapped error. Others validate later, in the command body: argo's "unknown output mode: %s" only fires as a defensive fallback because the EnumFlagValue should have caught bad values earlier — meaning if you see it, the flag was likely set programmatically or bypassed validation. And some tools are deliberately non-fatal: agentmemory warns "Unknown --tools value" and falls back to 'all', while vitess's vtgate exits rather than starting with a buffer window under 1s.
The most reliable signal in these errors is that most of them enumerate the accepted values. jaeger's mapping error lists all four mapping types; crush names 'catwalk' or 'hyper'; pulumi's --approval-mode names manual, balanced, auto; hubble's --identity error lists reserved identity names. When the message lists options, the answer is literally in the error — you only need to match spelling and casing exactly, because matching is almost always case-sensitive (beads rejects --dolt-auto-commit=OFF, pulumi rejects --approval-mode Manual).
Across the 24 repositories, three recurring value shapes dominate: output-format enums (--output/-o, where each argo, cilium, and pulumi subcommand has its own different allowlist), boolean-like flags (which variously accept true/false only, strconv.ParseBool's set, or true/false/1/0), and numeric or path-typed values (uint64 trace ids, single-character delimiters, absolute paths, RSA key sizes capped at 4096). The exact accepted set for a flag is library- and even subcommand-specific, so a value valid for one command in a tool is frequently invalid for its sibling commands.
Common causes
- Copying flag values between subcommands. -o json works for some argo/cilium/pulumi commands but not others: argo template list accepts only wide/name, argo lint only pretty/simple, hubble observe only compact/dict/json/jsonpb/tab/table, pulumi import only default/json. Scripts copied from one subcommand's examples fail on its siblings.
- Passing non-boolean values to boolean flags. yes, on, TRUE (in some tools), and 1 (in others) are rejected because parsers accept narrow sets: strconv.ParseBool forms for urfave/cli, strictly true/false for crush, true/false/1/0 for OpenCLI's boolean(). The accepted set is library-specific — check the tool's docs rather than assuming.
- Typos, casing, and whitespace in enum values. Matching is exact and case-sensitive: --dolt-auto-commit=OFF fails, --approval-mode Manual fails, 'catwalks' and 'Catwalk' fail, 'AL ' with trailing whitespace fails. Stray spaces from shell quoting can also turn a valid value into an empty or padded one.
- Unvalidated variables interpolated into flags. Env vars, CI templates, and config files feed stale or wrong values into flags — an older config format name, a mode name from a previous version, or an empty string when a variable is unset. Printing the interpolated value usually reveals the problem immediately.
- Values outside the type's numeric or format range. hubble --ip-trace-id must be a base-10 uint64 (no hex, no negatives), dgraph --keysize is capped at 4096 bits, pulumi --delimiter must be exactly one character, and --count must be non-negative. The value parses as a string but fails the type or range check.
- Shell quoting and value-consumption issues. --scope followed by another flag consumes the flag token as the value; unquoted values pick up stray spaces or get word-split; empty strings from "--flag ''" fail boolean parsers. Using --flag=value form and quoting values avoids most of these.
- Programmatically-set flags bypassing parse-time validation. argo's 'unknown output mode' and urfave/cli's 'parse error' are defensive fallbacks: the EnumFlagValue should have rejected the value during parsing, so hitting them in normal CLI use suggests the flag was set in code, in tests, or through a manipulated parse path.
What usually fixes it
- [object Object]
- [object Object]
- [object Object]
- [object Object]
- [object Object]
Go deeper
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Documented occurrences
- unknown output mode: %s (argoproj/argo-workflows)
- invalid mapping type %q: please pass one of %q, %q, %q, or %q as the mapping type (jaegertracing/jaeger)
- Invalid value for --%s: %s (cilium/cilium)
- parse error (urfave/cli)
- unknown output mode: %s (argoproj/argo-workflows)
- --proxied-server-root-path %v (gastownhall/beads)
- Key size value is too large (x > 4096) (dgraph-io/dgraph)
- --buffer-window must be >= 1s (specified value: %v) (vitessio/vitess)
- Unknown --tools value "${toolsMode}" (valid: all, core); falling back to all. (rohitg00/agentmemory)
- invalid value %q for flag -%s: %v (urfave/cli)
- invalid --dolt-auto-commit=%q (valid: off, on, batch) (gastownhall/beads)
- invalid output format: %s (cilium/cilium)
- %s: --%s expects true/false, got %q (charmbracelet/crush)
- unknown formatter: %s (argoproj/argo-workflows)
- Expected --scope user|project (Yeachan-Heo/oh-my-codex)
- unexpected output format %q (cilium/cilium)
- unsupported output format %s (cilium/cilium)
- invalid --ip-trace-id value: %w (cilium/cilium)
- invalid security identity, expected one of %v or a numeric value (cilium/cilium)
- can't parse args: %w (golangci/golangci-lint)
…and 78 more across the corpus — use search.
Honest provenance: generated on 2026-09-03 from AI-assisted analysis of the linked records. See how records are made.