vitessio/vitess · warning
invalid int value for %v: %v
Error message
invalid int value for %v: %v
What it means
The tabletserver debug env endpoint (/debug/env, ADMIN-only) allows live-tuning variables via POST. For integer variables set through setIntVal (MaxResultSize, WarnResultSize), the submitted value must parse with strconv.Atoi; this error is returned — surfaced as HTTP 400 — when the value is not a valid integer.
Source
Thrown at go/vt/vttablet/tabletserver/debugenv.go:97
default:
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
}
}
func handlePost(tsv *TabletServer, w http.ResponseWriter, r *http.Request) {
varname := r.FormValue("varname")
value := r.FormValue("value")
var msg string
if varname == "" || value == "" {
http.Error(w, "Missing varname or value", http.StatusBadRequest)
return
}
setIntVal := func(f func(int)) error {
ival, err := strconv.Atoi(value)
if err != nil {
return fmt.Errorf("invalid int value for %v: %v", varname, err)
}
f(ival)
msg = fmt.Sprintf("Setting %v to: %v", varname, value)
return nil
}
setIntValCtx := func(f func(context.Context, int) error) error {
ival, err := strconv.Atoi(value)
if err == nil {
err = f(r.Context(), ival)
}
if err != nil {
return fmt.Errorf("failed setting value for %v: %v", varname, err)
}
msg = fmt.Sprintf("Setting %v to: %v", varname, value)
return nil
}
View on GitHub (pinned to 01a25a7d17)
Solutions
- Resubmit the value as a plain base-10 integer, e.g. 10000 instead of 10k
- Remove any whitespace, commas, or units from the value
- Check the wrapped strconv error in the message for the exact parse problem (syntax vs out-of-range)
- Use the /debug/env page's form directly so the varname/value form fields are populated correctly
Example fix
// before: POST value value="10k" // after value="10000"
Defensive patterns
Strategy: validation
Validate before calling
value := "10000"
if _, err := strconv.Atoi(value); err != nil {
return fmt.Errorf("%s is not a plain base-10 integer", value)
}
// then POST /debug/env?varname=MaxResultSize&value=10000 Try / catch
resp, err := http.PostForm(url, url.Values{"varname": {"MaxResultSize"}, "value": {"10000"}})
if resp.StatusCode == http.StatusBadRequest {
body, _ := io.ReadAll(resp.Body)
log.Warn("debug env rejected value", slog.String("body", string(body)))
} Prevention
- Always submit plain base-10 integers — no units (10k), commas, spaces, or signs other than leading '-'
- Verify values with strconv.Atoi locally before scripting the POST
- Use the /debug/env HTML form so varname/value fields are populated correctly
- Remember int overflow also fails — keep values within Go int range
When it happens
Trigger: POST /debug/env with varname=MaxResultSize or WarnResultSize and a value that fails strconv.Atoi — e.g. '10k', '1,000', ' 100' (leading space), an empty/whitespace string, or an out-of-int-range number.
Common situations: Operators pasting values with units ('10000k') or thousands separators into the debug env HTML form; curl scripts sending unquoted or locale-formatted numbers.
Related errors
- failed setting value for %v: %v
- range %d should be >= %d
- UnescapeID err: invalid input identifier '%s'
- package %s is not under %s
- must specify at least one keyspace_shard to delete (got %+v)
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/ba6a7fe158f747e2.
Report an issue: GitHub.