{"record":{"id":"b1e3f1bbc855db17","repo":"vitessio/vitess","slug":"err-error-invalid-variable-set-value","errorCode":null,"errorMessage":"err.Error() (invalid variable set value)","messagePattern":"err\\.Error\\(\\) \\(invalid variable set value\\)","errorType":"http","errorClass":null,"httpStatus":400,"severity":"warning","filePath":"go/vt/vttablet/tabletserver/debugenv.go","lineNumber":172,"sourceCode":"\tcase \"MaxResultSize\":\n\t\terr = setIntVal(tsv.SetMaxResultSize)\n\tcase \"WarnResultSize\":\n\t\terr = setIntVal(tsv.SetWarnResultSize)\n\tcase \"RowStreamerMaxInnoDBTrxHistLen\":\n\t\terr = setInt64Val(func(val int64) { tsv.Config().RowStreamer.MaxInnoDBTrxHistLen = val })\n\tcase \"RowStreamerMaxMySQLReplLagSecs\":\n\t\terr = setInt64Val(func(val int64) { tsv.Config().RowStreamer.MaxMySQLReplLagSecs = val })\n\tcase \"UnhealthyThreshold\":\n\t\terr = setDurationVal(func(d time.Duration) { tsv.Config().Healthcheck.UnhealthyThreshold = d })\n\tcase \"ThrottleMetricThreshold\":\n\t\terr = setFloat64Val(tsv.SetThrottleMetricThreshold)\n\tcase \"Consolidator\":\n\t\ttsv.SetConsolidatorMode(value)\n\t\tmsg = fmt.Sprintf(\"Setting %v to: %v\", varname, value)\n\t}\n\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tvars := getVars(tsv)\n\tsendResponse(r, w, vars, msg)\n}\n\nfunc handleGet(tsv *TabletServer, w http.ResponseWriter, r *http.Request) {\n\tvars := getVars(tsv)\n\tsendResponse(r, w, vars, \"\")\n}\n\nfunc sendResponse(r *http.Request, w http.ResponseWriter, vars []envValue, msg string) {\n\tformat := r.FormValue(\"format\")\n\tif format == \"json\" {\n\t\trespondWithJSON(w, vars, msg)\n\t\treturn\n\t}","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vttablet/tabletserver/debugenv.go#L154-L190","documentation":"After attempting to set the requested variable, handlePost returns HTTP 400 with the strconv/parse error text if setting an integer-valued variable failed. The setIntVal helper does strconv.Atoi(value) and the error surfaces here — meaning the supplied value was not a valid integer (or the variable name was unknown to the switch and a parse failed).","triggerScenarios":"POST /debugenv setting a numeric variable (e.g. query log thresholds, max_concurrent transactions) with a non-integer value like 'abc' or '1.5'; unknown varname combined with a code path that still attempted a parse.","commonSituations":"Automation sending string values ('on'/'off') to integer variables; locale/whitespace in values; scripts updated for new variable names but old value types.","solutions":["Send a plain base-10 integer for numeric variables, e.g. value=100","Check which variable you're setting and match its expected type (Consolidator takes a string mode, most others take ints)","Use GET /debugenv first to inspect the variable and its current value format"],"exampleFix":"// before\ncurl -X POST 'http://tablet:15100/debugenv' -d 'varname=MaxConcurrentTransactions&value=many'\n// after\ncurl -X POST 'http://tablet:15100/debugenv' -d 'varname=MaxConcurrentTransactions&value=64'","handlingStrategy":"validation","validationCode":"if _, err := strconv.Atoi(value); err != nil {\n    return fmt.Errorf(\"value %q is not a valid integer for %s\", value, varname)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["GET /debugenv first to inspect each variable's expected format","Send plain base-10 integers for numeric variables","Keep automation value formats in sync with variable types"],"tags":["http-api","vttablet","bad-request","parsing"],"backgroundTag":"invalid-parameter-format","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}