{"record":{"id":"56bfe8c6b58ec38e","repo":"hashicorp/nomad","slug":"invalid-value-for-out-valid-values-are-go-tem-56bfe8","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_put.go","lineNumber":612,"sourceCode":"\tdefault:\n\t\treturn errors.New(errInvalidInFormat)\n\t}\n}\n\nfunc (c *VarPutCommand) validateOutputFlag() error {\n\tif c.outFmt != \"go-template\" && c.tmpl != \"\" {\n\t\treturn errors.New(errUnexpectedTemplate)\n\t}\n\tswitch c.outFmt {\n\tcase \"none\", \"json\", \"hcl\", \"table\":\n\t\treturn nil\n\tcase \"go-template\":\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 warnInvalidIdentifier(in string) error {\n\tinvalid := invalidIdentifier.FindAllString(in, -1)\n\tif len(invalid) == 0 {\n\t\treturn nil\n\t}\n\n\t// Use %s instead of %q to avoid escaping characters.\n\treturn fmt.Errorf(\n\t\t`\"%s\" contains characters %s that require the 'index' function for direct access in templates`,\n\t\tin,\n\t\tformatInvalidVarKeyChars(invalid),\n\t)\n}\n\nfunc formatInvalidVarKeyChars(invalid []string) string {","sourceCodeStart":594,"sourceCodeEnd":630,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/var_put.go#L594-L630","documentation":"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.","triggerScenarios":"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 ...`).","commonSituations":"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.","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"],"exampleFix":"// before\nnomad var put -out yaml app/secret key=value\n// after\nnomad var put -out json app/secret key=value","handlingStrategy":"validation","validationCode":"var valid = map[string]bool{\"go-template\":true,\"hcl\":true,\"json\":true,\"none\":true,\"table\":true}\nif !valid[out] {\n    return fmt.Errorf(\"invalid -out %q; valid: go-template, hcl, json, none, table\", out)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["cli","nomad","validation","output-format"],"backgroundTag":"invalid-enum-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"}