{"record":{"id":"e2e1aa3094eee98e","repo":"hashicorp/terraform","slug":"no-value-in-arg-s","errorCode":null,"errorMessage":"No '=' value in arg: %s","messagePattern":"No '=' value in arg: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/command/flag_kv.go","lineNumber":23,"sourceCode":"\nimport (\n\t\"fmt\"\n\t\"strings\"\n)\n\n// FlagStringKV is a flag.Value implementation for parsing user variables\n// from the command-line in the format of '-var key=value', where value is\n// only ever a primitive.\ntype FlagStringKV map[string]string\n\nfunc (v *FlagStringKV) String() string {\n\treturn \"\"\n}\n\nfunc (v *FlagStringKV) Set(raw string) error {\n\tidx := strings.Index(raw, \"=\")\n\tif idx == -1 {\n\t\treturn fmt.Errorf(\"No '=' value in arg: %s\", raw)\n\t}\n\n\tif *v == nil {\n\t\t*v = make(map[string]string)\n\t}\n\n\tkey, value := raw[0:idx], raw[idx+1:]\n\t(*v)[key] = value\n\treturn nil\n}\n","sourceCodeStart":5,"sourceCodeEnd":34,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/command/flag_kv.go#L5-L34","documentation":"Thrown by FlagStringKV.Set when parsing a -var argument that does not contain '='. FlagStringKV splits each token on the first '=' into key/value; without one it cannot form a pair, so the whole token is rejected. This powers -var key=value for primitive values (distinct from -var-file).","triggerScenarios":"Passing `-var myvar` (no value), `-var myvar=` (empty value is actually OK — '=' present), or any -var token lacking an '=' separator. Also triggered by misuse like `-var 'myvar'` expecting a prompt.","commonSituations":"Forgetting the value; using a space instead of '=' (shell then splits the value into a separate arg); quoting mistakes; expecting interactive variable entry where none is configured.","solutions":["Provide key=value in the same token: `-var environment=prod`.","Quote the whole pair if the value has spaces: `-var \"name=John Doe\"`.","If the value is genuinely empty, include the '=': `-var foo=`.","For many variables, use -var-file with a .tfvars file instead."],"exampleFix":"// before\n//   terraform plan -var environment\n// after\n//   terraform plan -var environment=prod\n// or with spaces:\n//   terraform plan -var \"owner=John Doe\"","handlingStrategy":"validation","validationCode":"func validateVarToken(raw string) error {\n    if !strings.Contains(raw, \"=\") {\n        return fmt.Errorf(\"-var requires key=value; got %q\", raw)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass -var as a single key=value token.","Quote the whole pair when the value has spaces.","Prefer -var-file for many or complex variables."],"tags":["cli","variables","flags","user-error","terraform-cli"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}