mislav/hub · error

Error %s: %s

Error message

Error %s: %s

What it means

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.

Source

Thrown at github/client.go:1202

func reverseNormalizeHost(host string) string {
	switch host {
	case "api.github.com":
		return GitHubHost
	case "api.github.localhost":
		return "github.localhost"
	default:
		return host
	}
}

func checkStatus(expectedStatus int, action string, response *simpleResponse, err error) error {
	if err != nil {
		errStr := err.Error()
		if urlErr, isURLErr := err.(*url.Error); isURLErr {
			errStr = fmt.Sprintf("%s %s: %s", urlErr.Op, urlErr.URL, urlErr.Err)
		}
		return fmt.Errorf("Error %s: %s", action, errStr)
	} else if response.StatusCode != expectedStatus {
		errInfo, err := response.ErrorInfo()
		if err != nil {
			return fmt.Errorf("Error %s: %s (HTTP %d)", action, err.Error(), response.StatusCode)
		}
		return FormatError(action, errInfo)
	}
	return nil
}

// FormatError annotates an HTTP response error with user-friendly messages
func FormatError(action string, err error) error {
	if e, ok := err.(*errorInfo); ok {
		return formatError(action, e)
	}
	return err
}

View on GitHub (pinned to 5c547ed804)

Solutions

  1. Check network connectivity to the API host (`curl -v https://api.github.com`).
  2. Configure HTTPS_PROXY/HTTP_PROXY if you're behind a proxy.
  3. Fix TLS trust (add corporate CA to the system trust store) if the error is a certificate error.
  4. Retry on transient timeouts; check DNS resolution if the error is 'no such host'.
Defensive patterns

Strategy: retry

Validate before calling

if _, err := net.LookupHost("api.github.com"); err != nil {
    return fmt.Errorf("cannot resolve api.github.com; check network/DNS/proxy")
}

Type guard

var urlErr *url.Error
if errors.As(err, &urlErr) { /* transport-level failure */ }

Try / catch

err := doAPICall()
if err != nil {
    var ue *url.Error
    if errors.As(err, &ue) && isTransient(ue.Err) {
        time.Sleep(backoff); retry()
    }
}

Prevention

When it happens

Trigger: 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').

Common situations: 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.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


AI-assisted analysis of mislav/hub@5c547ed804 (2026-09-01). Data as JSON: /api/errors/d41e53ec0ea1c6cc. Report an issue: GitHub.