tailscale/tailscale · error

invalid waitsec

Error message

invalid waitsec

What it means

The Taildrop file list endpoint accepts a 'waitsec' parameter to long-poll for new files. It fires when a non-empty, non-zero waitsec value is not an integer, so a deadline cannot be computed.

Source

Thrown at feature/taildrop/localapi.go:430

		return
	}

	suffix, ok := strings.CutPrefix(r.URL.EscapedPath(), "/localapi/v0/files/")
	if !ok {
		http.Error(w, "misconfigured", http.StatusInternalServerError)
		return
	}
	if suffix == "" {
		if r.Method != "GET" {
			http.Error(w, "want GET to list files", http.StatusBadRequest)
			return
		}
		ctx := r.Context()
		var wfs []apitype.WaitingFile
		if s := r.FormValue("waitsec"); s != "" && s != "0" {
			d, err := strconv.Atoi(s)
			if err != nil {
				http.Error(w, "invalid waitsec", http.StatusBadRequest)
				return
			}
			deadline := time.Now().Add(time.Duration(d) * time.Second)
			var cancel context.CancelFunc
			ctx, cancel = context.WithDeadline(ctx, deadline)
			defer cancel()
			wfs, err = ext.AwaitWaitingFiles(ctx)
			if err != nil && ctx.Err() == nil {
				http.Error(w, err.Error(), http.StatusInternalServerError)
				return
			}
		} else {
			var err error
			wfs, err = ext.WaitingFiles()
			if err != nil {
				http.Error(w, err.Error(), http.StatusInternalServerError)
				return
			}

View on GitHub (pinned to 6e0912f979)

Solutions

  1. Pass a non-negative integer for the waitsec query parameter.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at feature/taildrop/localapi.go:430 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tailscale/tailscale@6e0912f979 (2026-08-18). Data as JSON: /api/errors/6ead0546e1f540df. Report an issue: GitHub.