hashicorp/nomad · error
Invalid value for "-out"; valid values are [go-template, jso
Error message
Invalid value for "-out"; valid values are [go-template, json, table, terse]
What it means
VarListCommand.validateOutputFlag checks -output against the list-specific allowlist (go-template, json, terse, table). Unknown values hit the default case and return this error, which differs from the get command's allowlist (no hcl/none).
Source
Thrown at command/var_list.go:303
}
return pList
}
func (c *VarListCommand) validateOutputFlag() error {
if c.outFmt != "go-template" && c.tmpl != "" {
return errors.New(errUnexpectedTemplate)
}
switch c.outFmt {
case "json", "terse", "table":
return nil
case "go-template":
if c.tmpl == "" {
return errors.New(errMissingTemplate)
}
return nil
default:
return errors.New(errInvalidListOutFormat)
}
}
View on GitHub (pinned to 482b49bf1a)
Solutions
- Use one of: go-template, json, table, terse (lowercase)
- Do not reuse the kv get format list for kv list; fix the value
- Render to another format by piping json through jq/yq
Example fix
// before vault kv list -output=hcl secret/ // after vault kv list -output=json secret/ | jq .
Defensive patterns
Strategy: validation
Validate before calling
switch outFmt {
case "go-template", "json", "table", "terse":
// ok
default:
return fmt.Errorf("invalid -out %q; must be one of go-template,json,table,terse", outFmt)
} Try / catch
if err := cmd.validateOutputFlag(); err != nil {
if strings.Contains(err.Error(), "Invalid value for \"-out\"") {
// map unsupported formats (hcl/none) to json and retry
}
return err
} Prevention
- Do not share the kv get format allowlist with kv list
- Use shell completion for valid values
- Normalize case before passing -output
When it happens
Trigger: Running `vault kv list -output=hcl|none|yaml <path>` — formats valid for `kv get` but not `kv list` — or any misspelling.
Common situations: Copy-pasting -output=hcl or -output=none from a `kv get` command into `kv list`; typos in scripts; case mismatches like -output=JSON.
Understand the failure class
Background: "unknown output mode", "invalid value for flag", "expects true/false": fixing invalid flag value errors in CLI tools — this error's family across 24 libraries.
Related errors
- The '-template' flag is only valid when using 'go-template'
- A template must be supplied using '-template' when using go-
- Invalid value for "-out"; valid values are [go-template, hcl
- The '-template' flag is only valid when using 'go-template'
- A template must be supplied using '-template' when using go-
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/51aefca913f67560.
Report an issue: GitHub.