{"record":{"id":"195474652f2dbee9","repo":"micro/go-micro","slug":"failed-request","errorCode":null,"errorMessage":"failed request","messagePattern":"failed request","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/util/http/roundtripper.go","lineNumber":38,"sourceCode":"\t}\n\n\tnext := r.st(s)\n\n\t// rudimentary retry 3 times\n\tfor i := 0; i < 3; i++ {\n\t\tn, err := next()\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\treq.URL.Host = n.Address\n\t\tw, err := r.rt.RoundTrip(req)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\treturn w, nil\n\t}\n\n\treturn nil, errors.New(\"failed request\")\n}\n","sourceCodeStart":20,"sourceCodeEnd":40,"githubUrl":"https://github.com/micro/go-micro/blob/24529f140421a11a33b6999ab7944f2021cfd69c/internal/util/http/roundtripper.go#L20-L40","documentation":"RoundTrip in internal/util/http returns this generic error when the wrapped transport's RoundTrip fails on every retry attempt and no response could be produced. It deliberately discards the underlying per-attempt error, so callers only know that all attempts to complete the HTTP request failed.","triggerScenarios":"An HTTP request going through this RoundTripper where each attempt's RoundTrip returns a non-nil error (connection refused, TLS handshake failure, DNS failure, timeouts) until attempts are exhausted.","commonSituations":"Target service down or wrong host/port; network partition between client and server; TLS certificate problems; DNS misconfiguration in containers/k8s; transient outages that outlast the retry budget.","solutions":["Check the target service is reachable: verify host, port, DNS, and that the service is listening (curl/telnet the endpoint).","Inspect network/TLS setup — proxies, certificates, and firewall rules between client and server.","Increase retry tolerance or timeouts if failures are transient, and add backoff.","Wrap or modify the RoundTripper to log/join the underlying attempt errors, since this sentinel hides the root cause."],"exampleFix":"// before\nresp, err := client.Do(req) // err: \"failed request\" with no cause\n\n// after\nresp, err := client.Do(req)\nif err != nil && err.Error() == \"failed request\" {\n\tlog.Errorf(\"all roundtrip attempts failed for %s: underlying=%v\", req.URL, lastAttemptErr)\n}","handlingStrategy":"retry","validationCode":"conn, err := net.DialTimeout(\"tcp\", host+\":\"+port, 3*time.Second)\nif err != nil {\n\treturn fmt.Errorf(\"target %s:%s unreachable before request: %w\", host, port, err)\n}\nconn.Close()","typeGuard":null,"tryCatchPattern":"resp, err := client.Do(req)\nif err != nil {\n\tif err.Error() == \"failed request\" {\n\t\t// underlying cause is hidden; retry with backoff, then alert\n\t\treturn retryWithBackoff(req, 3)\n\t}\n\treturn err\n}","preventionTips":["Health-check the target endpoint before issuing requests through this client.","Configure sensible timeouts and retry budgets on the transport.","Instrument the RoundTripper to log/join per-attempt errors so the generic sentinel doesn't hide root causes.","Verify DNS/TLS configuration in containerized environments where name resolution differs."],"tags":["http","network","transport","retry","opaque-error"],"backgroundTag":"request-failed","analyzedSha":"24529f140421a11a33b6999ab7944f2021cfd69c","analyzedAt":"2026-09-01T02:52:24.923Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}