{"record":{"id":"0907edaf768c028d","repo":"juanfont/headscale","slug":"internal-server-error","errorCode":null,"errorMessage":"internal server error","messagePattern":"internal server error","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"hscontrol/handlers.go","lineNumber":31,"sourceCode":"\n\t\"github.com/juanfont/headscale/hscontrol/assets\"\n\t\"github.com/juanfont/headscale/hscontrol/templates\"\n\t\"github.com/juanfont/headscale/hscontrol/types\"\n\t\"github.com/rs/zerolog/log\"\n\t\"tailscale.com/tailcfg\"\n)\n\nconst (\n\treservedResponseHeaderSize = 4\n)\n\n// httpError logs an error and sends an HTTP error response with the given.\nfunc httpError(w http.ResponseWriter, err error) {\n\tif herr, ok := errors.AsType[HTTPError](err); ok {\n\t\thttp.Error(w, herr.Msg, herr.Code)\n\t\tlog.Error().Err(herr.Err).Int(\"code\", herr.Code).Msgf(\"user msg: %s\", herr.Msg)\n\t} else {\n\t\thttp.Error(w, \"internal server error\", http.StatusInternalServerError)\n\t\tlog.Error().Err(err).Int(\"code\", http.StatusInternalServerError).Msg(\"http internal server error\")\n\t}\n}\n\n// httpUserError logs an error and sends a styled HTML error page.\n// Use this for browser-facing error paths (OIDC, registration confirm)\n// where the user should see a branded page instead of plain text.\n// Technical details go to the server log; the HTML page only shows\n// an actionable message derived from the HTTP status code.\nfunc httpUserError(w http.ResponseWriter, err error) {\n\tcode := http.StatusInternalServerError\n\n\tif herr, ok := errors.AsType[HTTPError](err); ok {\n\t\tif herr.Code != 0 {\n\t\t\tcode = herr.Code\n\t\t}\n\n\t\tlog.Error().Err(herr.Err).Int(\"code\", code).Msgf(\"user msg: %s\", herr.Msg)","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/hscontrol/handlers.go#L13-L49","documentation":"Error \"internal server error\" thrown in juanfont/headscale.","triggerScenarios":"Thrown at hscontrol/handlers.go:31 when the library encounters an invalid state.","commonSituations":"A generic internal server error was returned. Inspect headscale server logs at the time of the request for the underlying error.","solutions":["Inspect the wrapped error for the underlying cause and correct the failing condition (internal server error); retry the operation after fixing the input, configuration, or environment."],"exampleFix":"Inspect the wrapped error for the underlying cause and correct the failing condition (internal server error); 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-16T03:17:38.424Z"}