{"record":{"id":"983356226122950b","repo":"hashicorp/nomad","slug":"invalid-value-for-out-valid-values-are-go-tem","errorCode":null,"errorMessage":"Invalid value for \"-out\"; valid values are [go-template, hcl, json, none, table]","messagePattern":"Invalid value for \"-out\"; valid values are \\[go-template, hcl, json, none, table\\]","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/var_get.go","lineNumber":214,"sourceCode":"\t\tc.Ui.Warn(hint)\n\t}\n\treturn 0\n}\n\nfunc (c *VarGetCommand) validateOutputFlag() error {\n\tif c.outFmt != \"go-template\" && c.tmpl != \"\" {\n\t\treturn errors.New(errUnexpectedTemplate)\n\t}\n\tswitch c.outFmt {\n\tcase \"hcl\", \"json\", \"none\", \"table\":\n\t\treturn nil\n\tcase \"go-template\": //noop - needs more validation\n\t\tif c.tmpl == \"\" {\n\t\t\treturn errors.New(errMissingTemplate)\n\t\t}\n\t\treturn nil\n\tdefault:\n\t\treturn errors.New(errInvalidOutFormat)\n\t}\n}\n\nfunc (c *VarGetCommand) GetConcurrentUI() cli.ConcurrentUi {\n\treturn cli.ConcurrentUi{Ui: c.Ui}\n}\n","sourceCodeStart":196,"sourceCodeEnd":221,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/var_get.go#L196-L221","documentation":"VarGetCommand.validateOutputFlag validates -output against a fixed allowlist (go-template, hcl, json, none, table). Any other value falls through the switch default and returns this error listing the valid values.","triggerScenarios":"Running `vault kv get -output=yaml|csv|text <path>` or any misspelled/upper-cased format value.","commonSituations":"Typo in scripts (e.g. -output=JSON instead of json); assuming formats supported by other tools (yaml) are valid here; older scripts using deprecated format names.","solutions":["Use one of: go-template, hcl, json, none, table (lowercase)","Fix the spelling/case of the -output value","Pipe json output through another tool if you need a different serialization"],"exampleFix":"// before\nvault kv get -output=yaml secret/foo\n// after\nvault kv get -output=json secret/foo | jq .","handlingStrategy":"validation","validationCode":"switch outFmt {\ncase \"go-template\", \"hcl\", \"json\", \"none\", \"table\":\n\t// ok\ndefault:\n\treturn fmt.Errorf(\"invalid -out %q; must be one of go-template,hcl,json,none,table\", outFmt)\n}","typeGuard":null,"tryCatchPattern":"if err := cmd.validateOutputFlag(); err != nil {\n\tif strings.Contains(err.Error(), \"Invalid value for \\\"-out\\\"\") {\n\t\t// normalize/fix outFmt (e.g. lowercase, map yaml->json) and retry\n\t}\n\treturn err\n}","preventionTips":["Keep a shell completion/allowlist for -output values","Lowercase and trim the format value in wrapper scripts","Remember kv get accepts hcl/none but kv list does not"],"tags":["go","cli","flags","validation"],"backgroundTag":"invalid-flag-value","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}