{"record":{"id":"05bc3a5db25b0e69","repo":"vitessio/vitess","slug":"failed-setting-value-for-v-v","errorCode":null,"errorMessage":"failed setting value for %v: %v","messagePattern":"failed setting value for (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"go/vt/vttablet/tabletserver/debugenv.go","lineNumber":110,"sourceCode":"\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}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed setting value for %v: %v\", varname, err)\n\t\t}\n\t\tmsg = fmt.Sprintf(\"Setting %v to: %v\", varname, value)\n\t\treturn nil\n\t}\n\n\tsetInt64Val := func(f func(int64)) error {\n\t\tival, err := strconv.ParseInt(value, 10, 64)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid int64 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\tsetDurationVal := func(f func(time.Duration)) error {\n\t\tdurationVal, err := time.ParseDuration(value)\n\t\tif err != nil {","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vttablet/tabletserver/debugenv.go#L92-L128","documentation":"For context-aware integer variables on the debug env endpoint (ReadPoolSize, StreamPoolSize, TransactionPoolSize), setIntValCtx first parses the value with strconv.Atoi and then calls the setter (e.g. SetPoolSize) with the request context; this error wraps either the parse failure or the setter's own failure (e.g. refusing to resize a pool below what is in use). It is returned to the client as HTTP 400.","triggerScenarios":"POST /debug/env with varname ReadPoolSize/StreamPoolSize/TransactionPoolSize where the value is non-numeric (Atoi fails) or the setter function returns an error under the request context — such as resizing a pool to an invalid/too-small size or a context cancellation mid-call.","commonSituations":"Operators setting pool sizes with units or separators; shrinking a pool below the number of currently checked-out connections; request context cancelled (client disconnected) while the resize was applied.","solutions":["Verify the value is a plain base-10 integer (no units, commas, or spaces)","If the value parsed but the setter failed, read the wrapped inner error: e.g. pick a pool size >= current in-use connections","Retry the POST with the client connection kept open until the response arrives","Check tabletserver logs around the request for the underlying pool-resize error"],"exampleFix":"// before\nvalue=\"50 connections\"\n// after\nvalue=\"50\"","handlingStrategy":"validation","validationCode":"value := \"50\"\nif _, err := strconv.Atoi(value); err != nil {\n    return fmt.Errorf(\"%s is not a valid integer pool size\", value)\n}\ncurrent := tsv.PoolSize() // ensure new size >= currently in-use connections\n// then POST /debug/env?varname=ReadPoolSize&value=50","typeGuard":null,"tryCatchPattern":"resp, err := http.PostForm(url, url.Values{\"varname\": {\"ReadPoolSize\"}, \"value\": {\"50\"}})\nif resp.StatusCode == http.StatusBadRequest {\n    body, _ := io.ReadAll(resp.Body)\n    var inner string\n    if _, perr := fmt.Sscanf(string(body), \"failed setting value for %v: %v\", new(interface{}), &inner); perr == nil {\n        log.Warn(\"pool resize rejected\", slog.String(\"cause\", inner))\n    }\n}","preventionTips":["Submit plain base-10 integers with no units, commas, or whitespace","Choose a pool size not smaller than the number of currently in-use/checked-out connections","Keep the HTTP client connected until the response returns to avoid context cancellation mid-resize","Prefer setting pool sizes via tablet config flags for persistence; use /debug/env only for temporary tuning"],"tags":["tabletserver","http","validation","go"],"backgroundTag":"invalid-integer-input","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}