vitessio/vitess · warning

err.Error() (invalid variable set value)

Error message

err.Error() (invalid variable set value)

What it means

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).

Source

Thrown at go/vt/vttablet/tabletserver/debugenv.go:172

	case "MaxResultSize":
		err = setIntVal(tsv.SetMaxResultSize)
	case "WarnResultSize":
		err = setIntVal(tsv.SetWarnResultSize)
	case "RowStreamerMaxInnoDBTrxHistLen":
		err = setInt64Val(func(val int64) { tsv.Config().RowStreamer.MaxInnoDBTrxHistLen = val })
	case "RowStreamerMaxMySQLReplLagSecs":
		err = setInt64Val(func(val int64) { tsv.Config().RowStreamer.MaxMySQLReplLagSecs = val })
	case "UnhealthyThreshold":
		err = setDurationVal(func(d time.Duration) { tsv.Config().Healthcheck.UnhealthyThreshold = d })
	case "ThrottleMetricThreshold":
		err = setFloat64Val(tsv.SetThrottleMetricThreshold)
	case "Consolidator":
		tsv.SetConsolidatorMode(value)
		msg = fmt.Sprintf("Setting %v to: %v", varname, value)
	}

	if err != nil {
		http.Error(w, err.Error(), http.StatusBadRequest)
		return
	}

	vars := getVars(tsv)
	sendResponse(r, w, vars, msg)
}

func handleGet(tsv *TabletServer, w http.ResponseWriter, r *http.Request) {
	vars := getVars(tsv)
	sendResponse(r, w, vars, "")
}

func sendResponse(r *http.Request, w http.ResponseWriter, vars []envValue, msg string) {
	format := r.FormValue("format")
	if format == "json" {
		respondWithJSON(w, vars, msg)
		return
	}

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Send a plain base-10 integer for numeric variables, e.g. value=100
  2. Check which variable you're setting and match its expected type (Consolidator takes a string mode, most others take ints)
  3. Use GET /debugenv first to inspect the variable and its current value format

Example fix

// before
curl -X POST 'http://tablet:15100/debugenv' -d 'varname=MaxConcurrentTransactions&value=many'
// after
curl -X POST 'http://tablet:15100/debugenv' -d 'varname=MaxConcurrentTransactions&value=64'
Defensive patterns

Strategy: validation

Validate before calling

if _, err := strconv.Atoi(value); err != nil {
    return fmt.Errorf("value %q is not a valid integer for %s", value, varname)
}

Prevention

When it happens

Trigger: 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.

Common situations: Automation sending string values ('on'/'off') to integer variables; locale/whitespace in values; scripts updated for new variable names but old value types.

Related errors


AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01). Data as JSON: /api/errors/b1e3f1bbc855db17. Report an issue: GitHub.