{"record":{"id":"d41e53ec0ea1c6cc","repo":"mislav/hub","slug":"error-s-s","errorCode":null,"errorMessage":"Error %s: %s","messagePattern":"Error (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"github/client.go","lineNumber":1202,"sourceCode":"\nfunc reverseNormalizeHost(host string) string {\n\tswitch host {\n\tcase \"api.github.com\":\n\t\treturn GitHubHost\n\tcase \"api.github.localhost\":\n\t\treturn \"github.localhost\"\n\tdefault:\n\t\treturn host\n\t}\n}\n\nfunc checkStatus(expectedStatus int, action string, response *simpleResponse, err error) error {\n\tif err != nil {\n\t\terrStr := err.Error()\n\t\tif urlErr, isURLErr := err.(*url.Error); isURLErr {\n\t\t\terrStr = fmt.Sprintf(\"%s %s: %s\", urlErr.Op, urlErr.URL, urlErr.Err)\n\t\t}\n\t\treturn fmt.Errorf(\"Error %s: %s\", action, errStr)\n\t} else if response.StatusCode != expectedStatus {\n\t\terrInfo, err := response.ErrorInfo()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error %s: %s (HTTP %d)\", action, err.Error(), response.StatusCode)\n\t\t}\n\t\treturn FormatError(action, errInfo)\n\t}\n\treturn nil\n}\n\n// FormatError annotates an HTTP response error with user-friendly messages\nfunc FormatError(action string, err error) error {\n\tif e, ok := err.(*errorInfo); ok {\n\t\treturn formatError(action, e)\n\t}\n\treturn err\n}\n","sourceCodeStart":1184,"sourceCodeEnd":1220,"githubUrl":"https://github.com/mislav/hub/blob/5c547ed804368763064e51f3990851e267e88edd/github/client.go#L1184-L1220","documentation":"checkStatus is the shared response validator for all REST calls. This error occurs when the transport itself failed (err != nil): the library wraps it as 'Error <action>: <detail>', formatting *url.Error specially as '<op> <url>: <cause>'. It means the HTTP request never completed successfully — not an unexpected HTTP status.","triggerScenarios":"Network unreachable, DNS failure, TLS errors, connection refused/timeouts, or a canceled request during any API call, surfaced through checkStatus's action label (e.g. 'creating pull request').","commonSituations":"Working offline or behind a corporate proxy without proxy env vars configured; DNS not resolving api.github.com; self-signed/MITM proxy certificates breaking TLS; firewall blocking egress in CI.","solutions":["Check network connectivity to the API host (`curl -v https://api.github.com`).","Configure HTTPS_PROXY/HTTP_PROXY if you're behind a proxy.","Fix TLS trust (add corporate CA to the system trust store) if the error is a certificate error.","Retry on transient timeouts; check DNS resolution if the error is 'no such host'."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if _, err := net.LookupHost(\"api.github.com\"); err != nil {\n    return fmt.Errorf(\"cannot resolve api.github.com; check network/DNS/proxy\")\n}","typeGuard":"var urlErr *url.Error\nif errors.As(err, &urlErr) { /* transport-level failure */ }","tryCatchPattern":"err := doAPICall()\nif err != nil {\n    var ue *url.Error\n    if errors.As(err, &ue) && isTransient(ue.Err) {\n        time.Sleep(backoff); retry()\n    }\n}","preventionTips":["Configure HTTPS_PROXY in proxied/CI environments.","Add corporate CAs to the trust store for TLS interception setups.","Use exponential backoff with jitter for transient network errors.","Monitor connectivity to api.github.com in health checks."],"tags":["network","github-api","request-failure"],"backgroundTag":"http-request-failed","analyzedSha":"5c547ed804368763064e51f3990851e267e88edd","analyzedAt":"2026-09-01T03:34:15.525Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}