{"record":{"id":"838aaffcb642de32","repo":"vitessio/vitess","slug":"invalid-duration-value-for-v-v","errorCode":null,"errorMessage":"invalid duration value for %v: %v","messagePattern":"invalid duration value for (.+?): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"go/vt/vttablet/tabletserver/debugenv.go","lineNumber":129,"sourceCode":"\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 {\n\t\t\treturn fmt.Errorf(\"invalid duration value for %v: %v\", varname, err)\n\t\t}\n\t\tf(durationVal)\n\t\tmsg = fmt.Sprintf(\"Setting %v to: %v\", varname, value)\n\t\treturn nil\n\t}\n\n\tsetFloat64Val := func(f func(float64)) error {\n\t\tfval, err := strconv.ParseFloat(value, 64)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid float64 value for %v: %v\", varname, err)\n\t\t}\n\t\tf(fval)\n\t\tmsg = fmt.Sprintf(\"Setting %v to: %v\", varname, value)\n\t\treturn nil\n\t}\n\n\tvar err error\n\tswitch varname {","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vttablet/tabletserver/debugenv.go#L111-L147","documentation":"Same debug-env variable handler as the int64 case, but for variables of type time.Duration. The raw string is parsed with time.ParseDuration; if it fails (malformed unit, non-numeric, empty), the handler returns the variable name plus the underlying parse error.","triggerScenarios":"Setting a duration-typed debug env var (via setDurationVal) with a value like '5' (no unit), 'seconds' (wrong unit format), '5x' (unknown unit), or an empty string.","commonSituations":"Operators passing bare numbers ('30' instead of '30s'); Go duration strings forgotten to include units; values copied from config files that use seconds as floats ('0.5sec' is invalid, '0.5s' is valid).","solutions":["Send a Go-style duration string with a unit suffix, e.g. '30s', '1m30s', '500ms','2h'","Use whole-number seconds converted to a duration string instead of bare integers","Fix per the time.ParseDuration error embedded in the message (it names the bad unit/character)"],"exampleFix":"// before\nvalue=30\n// after\nvalue=30s","handlingStrategy":"validation","validationCode":"if _, err := time.ParseDuration(value); err != nil { return fmt.Errorf(\"invalid duration for %s: %w\", varname, err) }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include a unit suffix: 30s, 5m, 1h, 100ms","Never send bare numbers for duration vars","Validate values locally with time.ParseDuration before posting"],"tags":["parsing","duration","debug-env","tabletserver"],"backgroundTag":"invalid-duration-parsing","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}