{"record":{"id":"26d7f0cc777fe9b1","repo":"netbirdio/netbird","slug":"client-not-found-26d7f0","errorCode":null,"errorMessage":"client not found","messagePattern":"client not found","errorType":"http","errorClass":null,"httpStatus":404,"severity":"warning","filePath":"proxy/internal/debug/handler.go","lineNumber":824,"sourceCode":"\t\t// Values are reported in kB.\n\t\tout[k] = n * 1024\n\t}\n\treturn out\n}\n\nconst maxCaptureDuration = 30 * time.Minute\n\n// handleCapture streams a pcap or text packet capture for the given client.\n//\n// Query params:\n//\n//\tduration: capture duration (0 or absent = max, capped at 30m)\n//\tformat:   \"text\" for human-readable output (default: pcap)\n//\tfilter:   BPF-like filter expression (e.g. \"host 10.0.0.1 and tcp port 443\")\nfunc (h *Handler) handleCapture(w http.ResponseWriter, r *http.Request, accountID types.AccountID) {\n\tclient, ok := h.provider.GetClient(accountID)\n\tif !ok {\n\t\thttp.Error(w, \"client not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\n\tduration := maxCaptureDuration\n\tif durationStr := r.URL.Query().Get(\"duration\"); durationStr != \"\" {\n\t\td, err := time.ParseDuration(durationStr)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"invalid duration: \"+err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tif d < 0 {\n\t\t\thttp.Error(w, \"duration must not be negative\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tif d > 0 {\n\t\t\tduration = min(d, maxCaptureDuration)\n\t\t}\n\t}","sourceCodeStart":806,"sourceCodeEnd":842,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/proxy/internal/debug/handler.go#L806-L842","documentation":"The packet-capture debug endpoint GET /debug/clients/{accountID}/capture resolves the account through provider.GetClient before touching any query parameter. If the proxy process holds no client for that account ID, the request fails with 404 before duration, filter, or format are considered.","triggerScenarios":"GET /debug/clients/<id>/capture?... where <id> is unknown to this proxy process: stale, mistyped, or a client that was never started on this instance.","commonSituations":"Deep link from a debug page captured during a previous proxy run; capturing against a proxy replica that does not own the account; the account was removed while the page stayed open.","solutions":["Re-list clients via GET /debug/clients and use a live account_id","Verify you reached the same proxy instance that owns the account","Check /debug/health and proxy logs if you expect the client to be running"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"ids, err := fetchAccountIDs(proxyBase) // GET /debug/clients?format=json\nif err != nil {\n    return err\n}\nif !slices.Contains(ids, accountID) {\n    return fmt.Errorf(\"cannot capture: account %s unknown on this proxy\", accountID)\n}","typeGuard":"func isCaptureableAccount(liveIDs []string, id string) bool {\n    return slices.Contains(liveIDs, id)\n}","tryCatchPattern":null,"preventionTips":["Validate the account through /debug/clients before deep-linking capture URLs","On 404, refresh the client list instead of retrying the same ID"],"tags":["http","proxy","debug-ui","packet-capture","not-found"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}