netbirdio/netbird · warning

invalid value %q: %v

Error message

invalid value %q: %v

What it means

The value parameter of GET /debug/perf must pass strconv.ParseUint(raw, 10, 32): base-10, unsigned, and within uint32 range. Anything else is a 400 with the raw value and parse error echoed back. The value ends up as PreallocatedBuffersPerPool on every listed client.

Source

Thrown at proxy/internal/debug/handler.go:714

		})
		return
	}

	h.writeJSON(w, map[string]any{
		"success": true,
		"message": "client stopped",
	})
}

func (h *Handler) handlePerf(w http.ResponseWriter, r *http.Request) {
	raw := r.URL.Query().Get("value")
	if raw == "" {
		http.Error(w, "value parameter is required", http.StatusBadRequest)
		return
	}
	n, err := strconv.ParseUint(raw, 10, 32)
	if err != nil {
		http.Error(w, fmt.Sprintf("invalid value %q: %v", raw, err), http.StatusBadRequest)
		return
	}

	capN := uint32(n)
	applied := 0
	failed := map[string]string{}
	for accountID, client := range h.provider.ListClientsForStartup() {
		if err := client.SetPerformance(nbembed.Performance{PreallocatedBuffersPerPool: &capN}); err != nil {
			failed[string(accountID)] = err.Error()
			continue
		}
		applied++
	}

	resp := map[string]any{
		"success": true,
		"value":   capN,
		"applied": applied,

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. Send a plain base-10 integer between 0 and 4294967295, e.g. ?value=1024
  2. Validate client-side with strconv.ParseUint(v, 10, 32) before requesting
  3. Strip whitespace, units, and sign characters from scripted values

Example fix

// before
GET /debug/perf?value=1.5

// after: base-10 integer that fits uint32
GET /debug/perf?value=1024
Defensive patterns

Strategy: validation

Validate before calling

if _, err := strconv.ParseUint(v, 10, 32); err != nil {
    return fmt.Errorf("value must be a base-10 integer within uint32 range: %w", err)
}
// only then: GET /debug/perf?value=<v>

Type guard

func isUint32Decimal(s string) bool {
    _, err := strconv.ParseUint(s, 10, 32)
    return err == nil
}

Prevention

When it happens

Trigger: GET /debug/perf with ?value=-1, ?value=1.5, ?value=0x100, ?value=99999999999 (above uint32), or ?value=1024abc.

Common situations: Passing a float or a byte count from a load-test script; copying a hex constant; sending a value with units or whitespace appended.

Related errors


AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16). Data as JSON: /api/errors/b691c2bd5b5f3e95. Report an issue: GitHub.