vitessio/vitess · warning

invalid duration value for %v: %v

Error message

invalid duration value for %v: %v

What it means

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.

Source

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

		}
		msg = fmt.Sprintf("Setting %v to: %v", varname, value)
		return nil
	}

	setInt64Val := func(f func(int64)) error {
		ival, err := strconv.ParseInt(value, 10, 64)
		if err != nil {
			return fmt.Errorf("invalid int64 value for %v: %v", varname, err)
		}
		f(ival)
		msg = fmt.Sprintf("Setting %v to: %v", varname, value)
		return nil
	}

	setDurationVal := func(f func(time.Duration)) error {
		durationVal, err := time.ParseDuration(value)
		if err != nil {
			return fmt.Errorf("invalid duration value for %v: %v", varname, err)
		}
		f(durationVal)
		msg = fmt.Sprintf("Setting %v to: %v", varname, value)
		return nil
	}

	setFloat64Val := func(f func(float64)) error {
		fval, err := strconv.ParseFloat(value, 64)
		if err != nil {
			return fmt.Errorf("invalid float64 value for %v: %v", varname, err)
		}
		f(fval)
		msg = fmt.Sprintf("Setting %v to: %v", varname, value)
		return nil
	}

	var err error
	switch varname {

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Send a Go-style duration string with a unit suffix, e.g. '30s', '1m30s', '500ms','2h'
  2. Use whole-number seconds converted to a duration string instead of bare integers
  3. Fix per the time.ParseDuration error embedded in the message (it names the bad unit/character)

Example fix

// before
value=30
// after
value=30s
Defensive patterns

Strategy: validation

Validate before calling

if _, err := time.ParseDuration(value); err != nil { return fmt.Errorf("invalid duration for %s: %w", varname, err) }

Prevention

When it happens

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

Common situations: 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).

Related errors


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