{"record":{"id":"2b4f5abc2dea364c","repo":"gravitational/teleport","slug":"http-statustext-code-2b4f5a","errorCode":null,"errorMessage":"http.StatusText(code)","messagePattern":"http\\.StatusText\\(code\\)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/srv/app/aws/handler.go","lineNumber":123,"sourceCode":"\n\tvar err error\n\thandler.fwd, err = reverseproxy.New(\n\t\treverseproxy.WithRoundTripper(config.RoundTripper),\n\t\treverseproxy.WithLogger(config.Log),\n\t\treverseproxy.WithErrorHandler(handler.formatForwardResponseError),\n\t)\n\n\treturn handler, trace.Wrap(err)\n}\n\n// formatForwardResponseError converts an error to a status code and writes the code to a response.\nfunc (s *signerHandler) formatForwardResponseError(rw http.ResponseWriter, r *http.Request, err error) {\n\ts.Log.DebugContext(r.Context(), \"Failed to process request\", \"error\", err)\n\tcommon.SetTeleportAPIErrorHeader(rw, err)\n\n\t// Convert trace error type to HTTP and write response.\n\tcode := trace.ErrorToCode(err)\n\thttp.Error(rw, http.StatusText(code), code)\n}\n\n// ServeHTTP handles incoming requests by signing them and then forwarding them to the proper AWS API.\nfunc (s *signerHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {\n\treq.Body = utils.MaxBytesReader(w, req.Body, s.MaxHTTPRequestBodySize)\n\tif err := s.serveHTTP(w, req); err != nil {\n\t\ts.formatForwardResponseError(w, req, err)\n\t\treturn\n\t}\n}\n\n// serveHTTP is a helper to simplify error handling in ServeHTTP.\nfunc (s *signerHandler) serveHTTP(w http.ResponseWriter, req *http.Request) error {\n\tsessCtx, err := common.GetSessionContext(req)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/gravitational/teleport/blob/1283425b60ec5f60d509ba4c791183d452923ff7/lib/srv/app/aws/handler.go#L105-L141","documentation":"The AWS signer handler's formatForwardResponseError writes the standard status text (http.StatusText of the code derived from the trace error) as the response body when proxying a signed AWS API request fails; the literal is the reason phrase for the mapped code.","triggerScenarios":"Thrown at lib/srv/app/aws/handler.go:123 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the proxy logs for the underlying sign/forward error","Verify the AWS app integration credentials and allowed regions/tags","Address the root cause per the mapped status code 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"}