vitessio/vitess · warning

Missing varname or value

Error message

Missing varname or value

What it means

handlePost on /debugenv requires both varname and value form fields; if either is empty it returns HTTP 400 'Missing varname or value'. Without both, the handler cannot know which tabletserver variable to set or to what.

Source

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

	}

	switch r.Method {
	case http.MethodPost:
		handlePost(tsv, w, r)
	case http.MethodGet:
		handleGet(tsv, w, r)
	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)
		}

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Send both fields: POST /debugenv with varname=<name>&value=<value>
  2. Ensure the value is a non-empty string (e.g. quote '0' rather than sending empty)
  3. Check field spelling — exactly 'varname' and 'value'

Example fix

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

Strategy: validation

Validate before calling

if varname == "" || value == "" {
    return fmt.Errorf("both varname and value must be non-empty")
}

Prevention

When it happens

Trigger: POST /debugenv with an empty or missing varname or value form field, e.g. `curl -X POST .../debugenv -d 'varname='` or omitting the fields entirely.

Common situations: Curl calls using ?varname=x in the URL but form-value parsing expecting POST body (or vice versa in edge cases); empty strings passed by automation; typos in field names (var_name vs varname).

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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