{"record":{"id":"ce479a1ec9c6b6a1","repo":"gravitational/teleport","slug":"err-error-ce479a","errorCode":null,"errorMessage":"err.Error()","messagePattern":"err\\.Error\\(\\)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/web/ca_export.go","lineNumber":39,"sourceCode":"\t\"bytes\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"time\"\n\n\t\"github.com/gravitational/trace\"\n\t\"github.com/julienschmidt/httprouter\"\n\n\t\"github.com/gravitational/teleport/lib/client\"\n)\n\n// authExportPublic returns the CA Certs that can be used to set up a chain of trust which includes the current Teleport Cluster\n//\n// GET /webapi/sites/:site/auth/export?type=<auth type>\n// GET /webapi/auth/export?type=<auth type>\nfunc (h *Handler) authExportPublic(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\tif err := h.authExportPublicError(w, r, p); err != nil {\n\t\thttp.Error(w, err.Error(), trace.ErrorToCode(err))\n\t\treturn\n\t}\n\n\t// Success output handled by authExportPublicError.\n}\n\n// authExportPublicError implements authExportPublic, except it returns an error\n// in case of failure. Output is only written on success.\nfunc (h *Handler) authExportPublicError(w http.ResponseWriter, r *http.Request, p httprouter.Params) error {\n\terr := rateLimitRequest(r, h.limiter)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\tquery := r.URL.Query()\n\tcaType := query.Get(\"type\") // validated by ExportAllAuthorities\n\n\tctx := r.Context()","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/gravitational/teleport/blob/1283425b60ec5f60d509ba4c791183d452923ff7/lib/web/ca_export.go#L21-L57","documentation":"authExportPublic writes the error from exporting public CA certificates (err.Error()) plus its trace-mapped status to the response when fetching the cluster's trust-chain certs for the requested auth type fails.","triggerScenarios":"Thrown at lib/web/ca_export.go:39 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the requested ?type= parameter is a valid auth type","Check auth server health and proxy-to-auth connectivity","Retry the export request"],"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"}