{"record":{"id":"b077f682ccff732f","repo":"cloudflare/cloudflared","slug":"error-on-request-d-s","errorCode":null,"errorMessage":"error on request %d: %s","messagePattern":"error on request (.+?): (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"token/transfer.go","lineNumber":154,"sourceCode":"\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\treq.Header.Set(userAgentHeader, userAgent)\n\tresp, err := client.Do(req) // nolint: gosec\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\tdefer func() { _ = resp.Body.Close() }()\n\n\t// ignore everything other than server errors as the resource\n\t// may not exist until the user does the interaction\n\tif resp.StatusCode >= 500 {\n\t\tbuf := new(bytes.Buffer)\n\t\tif _, err := io.Copy(buf, resp.Body); err != nil {\n\t\t\treturn nil, \"\", err\n\t\t}\n\n\t\treturn nil, \"\", fmt.Errorf(\"error on request %d: %s\", resp.StatusCode, buf.String())\n\t}\n\tif resp.StatusCode != 200 {\n\t\tlog.Info().Msg(\"Waiting for login...\")\n\t\treturn nil, \"\", nil\n\t}\n\n\tbuf := new(bytes.Buffer)\n\tif _, err := io.Copy(buf, resp.Body); err != nil {\n\t\treturn nil, \"\", err\n\t}\n\treturn buf.Bytes(), resp.Header.Get(\"service-public-key\"), nil\n}\n","sourceCodeStart":136,"sourceCodeEnd":167,"githubUrl":"https://github.com/cloudflare/cloudflared/blob/2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f/token/transfer.go#L136-L167","documentation":"During the Access token transfer polling loop, the server returned an HTTP status >= 500. poll copies the response body into the error message so the operator can see what the remote transfer service said. This is an upstream/server-side failure, not a client bug.","triggerScenarios":"transferRequest's poll receives a response with StatusCode 500-599 from the Cloudflare Access token transfer endpoint.","commonSituations":"Cloudflare Access service incident or degraded edge; proxy/intermediary (corporate proxy) returning 502/504; rate limiting or internal server error while awaiting login completion.","solutions":["Retry the transfer/login after a short wait; the loop can be re-run.","Check the Cloudflare status page for Access incidents.","Inspect the body in the error message for the server's diagnostic.","Verify no corporate proxy is intercepting and failing the request (502/504)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"token, err := transferRequest(...)\nif err != nil {\n    var retriable = strings.Contains(err.Error(), \"error on request 5\")\n    if retriable {\n        time.Sleep(backoff); retry()\n    }\n}","preventionTips":["Check the Cloudflare status page before assuming a client bug","Use exponential backoff on 5xx responses","Bypass corporate proxies for cloudflared endpoints when possible"],"tags":["http","server-error","network"],"backgroundTag":"http-error-response","analyzedSha":"2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f","analyzedAt":"2026-09-06T04:14:33.757Z","contentChangedAt":"2026-09-06T04:14:33.757Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}