{"record":{"id":"b691c2bd5b5f3e95","repo":"netbirdio/netbird","slug":"invalid-value-q-v","errorCode":null,"errorMessage":"invalid value %q: %v","messagePattern":"invalid value %q: (.+?)","errorType":"http","errorClass":null,"httpStatus":400,"severity":"warning","filePath":"proxy/internal/debug/handler.go","lineNumber":714,"sourceCode":"\t\t})\n\t\treturn\n\t}\n\n\th.writeJSON(w, map[string]any{\n\t\t\"success\": true,\n\t\t\"message\": \"client stopped\",\n\t})\n}\n\nfunc (h *Handler) handlePerf(w http.ResponseWriter, r *http.Request) {\n\traw := r.URL.Query().Get(\"value\")\n\tif raw == \"\" {\n\t\thttp.Error(w, \"value parameter is required\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tn, err := strconv.ParseUint(raw, 10, 32)\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"invalid value %q: %v\", raw, err), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tcapN := uint32(n)\n\tapplied := 0\n\tfailed := map[string]string{}\n\tfor accountID, client := range h.provider.ListClientsForStartup() {\n\t\tif err := client.SetPerformance(nbembed.Performance{PreallocatedBuffersPerPool: &capN}); err != nil {\n\t\t\tfailed[string(accountID)] = err.Error()\n\t\t\tcontinue\n\t\t}\n\t\tapplied++\n\t}\n\n\tresp := map[string]any{\n\t\t\"success\": true,\n\t\t\"value\":   capN,\n\t\t\"applied\": applied,","sourceCodeStart":696,"sourceCodeEnd":732,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/proxy/internal/debug/handler.go#L696-L732","documentation":"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.","triggerScenarios":"GET /debug/perf with ?value=-1, ?value=1.5, ?value=0x100, ?value=99999999999 (above uint32), or ?value=1024abc.","commonSituations":"Passing a float or a byte count from a load-test script; copying a hex constant; sending a value with units or whitespace appended.","solutions":["Send a plain base-10 integer between 0 and 4294967295, e.g. ?value=1024","Validate client-side with strconv.ParseUint(v, 10, 32) before requesting","Strip whitespace, units, and sign characters from scripted values"],"exampleFix":"// before\nGET /debug/perf?value=1.5\n\n// after: base-10 integer that fits uint32\nGET /debug/perf?value=1024","handlingStrategy":"validation","validationCode":"if _, err := strconv.ParseUint(v, 10, 32); err != nil {\n    return fmt.Errorf(\"value must be a base-10 integer within uint32 range: %w\", err)\n}\n// only then: GET /debug/perf?value=<v>","typeGuard":"func isUint32Decimal(s string) bool {\n    _, err := strconv.ParseUint(s, 10, 32)\n    return err == nil\n}","tryCatchPattern":null,"preventionTips":["Run strconv.ParseUint(v, 10, 32) client-side before sending","Send integers only: no units, signs, decimals, or hex prefixes"],"tags":["http","proxy","debug-ui","validation","uint32"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}