{"record":{"id":"d40be1f3aeeba2f4","repo":"gravitational/teleport","slug":"err-error-d40be1","errorCode":null,"errorMessage":"err.Error()","messagePattern":"err\\.Error\\(\\)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/web/app/middleware.go","lineNumber":165,"sourceCode":"\t\t}\n\t}\n}\n\n// makeHandler creates a http.HandlerFunc.\nfunc makeHandler(handler handlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tif err := handler(w, r); err != nil {\n\t\t\twriteError(w, err)\n\t\t\treturn\n\t\t}\n\t}\n}\n\n// writeError gets the HTTP status code from trace and writes the error to the\n// response writer.\nfunc writeError(w http.ResponseWriter, err error) {\n\tcode := trace.ErrorToCode(err)\n\thttp.Error(w, err.Error(), code)\n}\n\ntype routerFunc func(http.ResponseWriter, *http.Request, httprouter.Params) error\n\ntype routerAuthFunc func(http.ResponseWriter, *http.Request, httprouter.Params, *session) error\n\ntype handlerAuthFunc func(http.ResponseWriter, *http.Request, *session) error\n\ntype handlerFunc func(http.ResponseWriter, *http.Request) error\n\ntype launcherURLParams struct {\n\t// clusterName is the cluster within which this application is running.\n\tclusterName string\n\t// publicAddr is the public address of this application.\n\tpublicAddr string\n\t// arn is the AWS role name, defined only when accessing AWS management console.\n\tarn string\n\t// stateToken if defined means initiating an app access auth exchange.","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/gravitational/teleport/blob/1283425b60ec5f60d509ba4c791183d452923ff7/lib/web/app/middleware.go#L147-L183","documentation":"writeError is the web UI's generic error writer: it maps the handler error to an HTTP status via trace.ErrorToCode and writes err.Error() as the plain-text body. The literal 'err.Error()' is the formatted message of whatever error the web handler returned.","triggerScenarios":"Thrown at lib/web/app/middleware.go:165 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the response body / web proxy logs to identify the underlying error","Address the root cause per the HTTP status code (auth, bad request, not found, server error) and retry"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1283425b60ec5f60d509ba4c791183d452923ff7","analyzedAt":"2026-09-02T04:06:41.601Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}