goharbor/harbor · error
failed to check health
Error message
failed to check health: %v
What it means
Wrapping error inside HTTPStatusCodeHealthChecker: the HTTP client Do call failed, meaning the health-probe request could not reach the target endpoint at all - DNS failure, connection refused, or timeout - rather than the endpoint reporting an unhealthy status.
Solutions
- Check network connectivity and DNS for the monitored endpoint.
- Confirm the target service is running and listening on the configured URL.
- Inspect the wrapped error for timeout vs connection-refused details; health checks re-run periodically.
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at src/controller/health/checker.go:58 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of goharbor/harbor@7b2fd08cc5 (2026-08-16).
Data as JSON: /api/errors/150362b7c8d75cfa.
Report an issue: GitHub.
Appendix: source
Thrown at src/controller/health/checker.go:58
timeout time.Duration, statusCode int) health.Checker {
return health.CheckFunc(func() error {
req, err := http.NewRequest(method, url, nil)
if err != nil {
return fmt.Errorf("failed to create request: %v", err)
}
for key, values := range header {
for _, value := range values {
req.Header.Add(key, value)
}
}
client := httputil.NewClient(&http.Client{
Transport: httputil.GetHTTPTransport(),
Timeout: timeout,
})
resp, err := client.Do(req)
if err != nil {
return fmt.Errorf("failed to check health: %v", err)
}
defer resp.Body.Close()
if resp.StatusCode != statusCode {
data, err := io.ReadAll(resp.Body)
if err != nil {
log.Debugf("failed to read response body: %v", err)
}
return fmt.Errorf("received unexpected status code: %d %s", resp.StatusCode, string(data))
}
return nil
})
}
type updater struct {
sync.Mutex
status error
}View on GitHub (pinned to 7b2fd08cc5)