hashicorp/nomad · error
Invalid value for "-out"; valid values are [go-template, hcl
Error message
Invalid value for "-out"; valid values are [go-template, hcl, json, none, table]
What it means
validateOutputFlag rejects any -out value other than the supported set: go-template, hcl, json, none, table. The error enumerates the valid values (errInvalidOutFormat) so the user can correct the flag.
Source
Thrown at command/var_put.go:612
default:
return errors.New(errInvalidInFormat)
}
}
func (c *VarPutCommand) validateOutputFlag() error {
if c.outFmt != "go-template" && c.tmpl != "" {
return errors.New(errUnexpectedTemplate)
}
switch c.outFmt {
case "none", "json", "hcl", "table":
return nil
case "go-template":
if c.tmpl == "" {
return errors.New(errMissingTemplate)
}
return nil
default:
return errors.New(errInvalidOutFormat)
}
}
func warnInvalidIdentifier(in string) error {
invalid := invalidIdentifier.FindAllString(in, -1)
if len(invalid) == 0 {
return nil
}
// Use %s instead of %q to avoid escaping characters.
return fmt.Errorf(
`"%s" contains characters %s that require the 'index' function for direct access in templates`,
in,
formatInvalidVarKeyChars(invalid),
)
}
func formatInvalidVarKeyChars(invalid []string) string {View on GitHub (pinned to 482b49bf1a)
Solutions
- Use one of the exact valid values: -out go-template, hcl, json, none, or table (lowercase)
- Correct the typo/casing in the -out flag value
- If templating is needed, use go-template together with -template
Example fix
// before nomad var put -out yaml app/secret key=value // after nomad var put -out json app/secret key=value
Defensive patterns
Strategy: validation
Validate before calling
var valid = map[string]bool{"go-template":true,"hcl":true,"json":true,"none":true,"table":true}
if !valid[out] {
return fmt.Errorf("invalid -out %q; valid: go-template, hcl, json, none, table", out)
} Prevention
- Use flag completion/whitelists in scripts generating -out values
- Remember formats are lowercase and case-sensitive
- Pin -out choices in wrapper scripts instead of free-form user input
When it happens
Trigger: Passing any string other than 'none', 'json', 'hcl', 'table', or 'go-template' to the -out flag of commands that call validateOutputFlag (e.g. `var put -out yaml ...`).
Common situations: Typos like `-out templte` or `-out JSON` (case-sensitive switch); carrying over formats from other tools (yaml, pretty); scripting that interpolates an unsupported value into -out.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- A template must be supplied using '-template' when using go-
- Group %v not found within job
- an address or id is required for the destination peer
- unknown format flag value
- missing secret ID
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/56bfe8c6b58ec38e.
Report an issue: GitHub.