{"record":{"id":"e747ba87d4f51008","repo":"juanfont/headscale","slug":"bad-form-data","errorCode":null,"errorMessage":"bad form data","messagePattern":"bad form data","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"hscontrol/debug.go","lineNumber":191,"sourceCode":"\tdebug.Handle(\"batcher\", \"Batcher connected nodes\", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\twriteDebug(w, r, func() any { return h.debugBatcherJSON() }, h.debugBatcher)\n\t}))\n\n\t// Ping endpoint: sends a [tailcfg.PingRequest] to a node and waits for it to respond.\n\t// Supports POST (form submit) and GET with ?node= (clickable quick-ping links).\n\tdebug.Handle(\"ping\", \"Ping a node to check connectivity\", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tvar (\n\t\t\tquery  string\n\t\t\tresult *templates.PingResult\n\t\t)\n\n\t\tswitch r.Method {\n\t\tcase http.MethodPost:\n\t\t\tr.Body = http.MaxBytesReader(w, r.Body, 4096) //nolint:mnd\n\n\t\t\terr := r.ParseForm()\n\t\t\tif err != nil {\n\t\t\t\thttp.Error(w, \"bad form data\", http.StatusBadRequest)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tquery = r.FormValue(\"node\")\n\t\t\tresult = h.doPing(r.Context(), query)\n\t\tcase http.MethodGet:\n\t\t\t// Support ?node= for auto-ping links from other debug pages.\n\t\t\tif q := r.URL.Query().Get(\"node\"); q != \"\" {\n\t\t\t\tquery = q\n\t\t\t\tresult = h.doPing(r.Context(), query)\n\t\t\t}\n\t\t}\n\n\t\tnodes := h.connectedNodesList()\n\n\t\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\t\tw.WriteHeader(http.StatusOK)\n\t\t_, _ = w.Write([]byte(templates.PingPage(query, result, nodes).Render())) //nolint:gosec // G705: templ component auto-escapes","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/hscontrol/debug.go#L173-L209","documentation":"Error \"bad form data\" thrown in juanfont/headscale.","triggerScenarios":"Thrown at hscontrol/debug.go:191 when the library encounters an invalid state.","commonSituations":"The submitted form data to the debug endpoint could not be parsed. Submit a valid application/x-www-form-urlencoded body.","solutions":["Inspect the wrapped error for the underlying cause and correct the failing condition (bad form data); retry the operation after fixing the input, configuration, or environment."],"exampleFix":"Inspect the wrapped error for the underlying cause and correct the failing condition (bad form data); retry the operation after fixing the input, configuration, or environment.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"565fd254d06c4c7f9a8cad1714a43445c79ba420","analyzedAt":"2026-08-15T13:12:30.133Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}