{"record":{"id":"f183a536a78cbe00","repo":"hashicorp/nomad","slug":"invalid-value-for-in-valid-values-are-hcl-js","errorCode":null,"errorMessage":"Invalid value for \"-in\"; valid values are [hcl, json]","messagePattern":"Invalid value for \"-in\"; valid values are \\[hcl, json\\]","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/var_put.go","lineNumber":595,"sourceCode":"\nfunc (c *VarPutCommand) setParserForFileArg(arg string) error {\n\tswitch filepath.Ext(arg) {\n\tcase \".json\":\n\t\tc.inFmt = \"json\"\n\tcase \".hcl\":\n\t\tc.inFmt = \"hcl\"\n\tdefault:\n\t\treturn fmt.Errorf(\"Unable to determine format of %s; Use the -in flag to specify it.\", arg)\n\t}\n\treturn nil\n}\n\nfunc (c *VarPutCommand) validateInputFlag() error {\n\tswitch c.inFmt {\n\tcase \"hcl\", \"json\":\n\t\treturn nil\n\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}","sourceCodeStart":577,"sourceCodeEnd":613,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/var_put.go#L577-L613","documentation":"Returned by VarPutCommand.validateInputFlag when the -in flag (or a file extension that could not be inferred) is neither \"hcl\" nor \"json\". The sentinel errInvalidInFormat marks an unusable input format for the variable payload.","triggerScenarios":"Running `vault kv put -in=yaml|toml|text ...` or a misspelled value like -in=HCL.","commonSituations":"Assuming yaml input is supported; case-sensitivity mistakes; scripts generated with wrong format names.","solutions":["Use -in=hcl or -in=json (lowercase)","Convert yaml/toml input to json or hcl before invoking","Fix spelling/case of the -in value"],"exampleFix":"// before\nvault kv put -in=yaml secret/foo @spec.yaml\n// after\nvault kv put -in=json secret/foo @spec.json","handlingStrategy":"validation","validationCode":"if inFmt != \"hcl\" && inFmt != \"json\" {\n\treturn fmt.Errorf(\"invalid -in %q; must be hcl or json\", inFmt)\n}","typeGuard":null,"tryCatchPattern":"if err := cmd.validateInputFlag(); err != nil {\n\tif strings.Contains(err.Error(), \"Invalid value for \\\"-in\\\"\") {\n\t\t// convert input to json/hcl and retry\n\t}\n\treturn err\n}","preventionTips":["Only hcl and json are accepted; convert yaml/toml beforehand","Lowercase the value in wrappers","Use shell completion to avoid typos"],"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"}