{"record":{"id":"3967f78494d36d66","repo":"gravitational/teleport","slug":"http-statustext-code-3967f7","errorCode":null,"errorMessage":"http.StatusText(code)","messagePattern":"http\\.StatusText\\(code\\)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/srv/app/gcp/handler.go","lineNumber":191,"sourceCode":"\t}\n\trecorder := httplib.NewResponseStatusRecorder(w)\n\ts.fwd.ServeHTTP(recorder, fwdRequest)\n\tstatus := uint32(recorder.Status())\n\n\tif err := sessionCtx.Audit.OnRequest(req.Context(), sessionCtx, fwdRequest, status, nil); err != nil {\n\t\t// log but don't return the error, because we already handed off request/response handling to the oxy forwarder.\n\t\ts.Log.WarnContext(req.Context(), \"Failed to emit audit event.\", \"error\", err)\n\t}\n\treturn nil\n}\n\nfunc (s *handler) 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// prepareForwardRequest prepares a request for forwarding, updating headers and target host. Several checks are made along the way.\nfunc (s *handler) prepareForwardRequest(r *http.Request, sessionCtx *common.SessionContext) (*http.Request, error) {\n\tforwardedHost, err := utils.GetSingleHeader(r.Header, \"X-Forwarded-Host\")\n\tif err != nil {\n\t\treturn nil, trace.AccessDenied(\"%s\", err)\n\t} else if !gcp.IsGCPEndpoint(forwardedHost) {\n\t\treturn nil, trace.AccessDenied(\"%q is not a GCP endpoint\", forwardedHost)\n\t}\n\n\tpayload, err := utils.GetAndReplaceRequestBody(r)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\treqCopy, err := http.NewRequest(r.Method, r.URL.String(), bytes.NewReader(payload))\n\tif err != nil {","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/gravitational/teleport/blob/1283425b60ec5f60d509ba4c791183d452923ff7/lib/srv/app/gcp/handler.go#L173-L209","documentation":"The GCP app handler's formatForwardResponseError writes the standard status text for the trace-mapped HTTP code as the response body when forwarding a request to the GCP API fails; the literal is the reason phrase for the mapped code.","triggerScenarios":"Thrown at lib/srv/app/gcp/handler.go:191 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the proxy logs for the underlying forward error","Verify the GCP app integration credentials and project configuration","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"}