{"record":{"id":"a698130d573f7dfa","repo":"vitessio/vitess","slug":"missing-varname-or-value","errorCode":null,"errorMessage":"Missing varname or value","messagePattern":"Missing varname or value","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"warning","filePath":"go/vt/vttablet/tabletserver/debugenv.go","lineNumber":90,"sourceCode":"\t}\n\n\tswitch r.Method {\n\tcase http.MethodPost:\n\t\thandlePost(tsv, w, r)\n\tcase http.MethodGet:\n\t\thandleGet(tsv, w, r)\n\tdefault:\n\t\thttp.Error(w, \"Method not allowed\", http.StatusMethodNotAllowed)\n\t}\n}\n\nfunc handlePost(tsv *TabletServer, w http.ResponseWriter, r *http.Request) {\n\tvarname := r.FormValue(\"varname\")\n\tvalue := r.FormValue(\"value\")\n\n\tvar msg string\n\tif varname == \"\" || value == \"\" {\n\t\thttp.Error(w, \"Missing varname or value\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tsetIntVal := func(f func(int)) error {\n\t\tival, err := strconv.Atoi(value)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid int value for %v: %v\", varname, err)\n\t\t}\n\t\tf(ival)\n\t\tmsg = fmt.Sprintf(\"Setting %v to: %v\", varname, value)\n\t\treturn nil\n\t}\n\n\tsetIntValCtx := func(f func(context.Context, int) error) error {\n\t\tival, err := strconv.Atoi(value)\n\t\tif err == nil {\n\t\t\terr = f(r.Context(), ival)\n\t\t}","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vttablet/tabletserver/debugenv.go#L72-L108","documentation":"handlePost on /debugenv requires both varname and value form fields; if either is empty it returns HTTP 400 'Missing varname or value'. Without both, the handler cannot know which tabletserver variable to set or to what.","triggerScenarios":"POST /debugenv with an empty or missing varname or value form field, e.g. `curl -X POST .../debugenv -d 'varname='` or omitting the fields entirely.","commonSituations":"Curl calls using ?varname=x in the URL but form-value parsing expecting POST body (or vice versa in edge cases); empty strings passed by automation; typos in field names (var_name vs varname).","solutions":["Send both fields: POST /debugenv with varname=<name>&value=<value>","Ensure the value is a non-empty string (e.g. quote '0' rather than sending empty)","Check field spelling — exactly 'varname' and 'value'"],"exampleFix":"// before\ncurl -X POST 'http://tablet:15100/debugenv' -d 'varname=Consolidator'\n// after\ncurl -X POST 'http://tablet:15100/debugenv' -d 'varname=Consolidator&value=on'","handlingStrategy":"validation","validationCode":"if varname == \"\" || value == \"\" {\n    return fmt.Errorf(\"both varname and value must be non-empty\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always send both varname and value form fields","Quote '0' or 'off' explicitly instead of sending empty strings","Use exact field names: varname, value"],"tags":["http-api","vttablet","bad-request","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}