{"record":{"id":"150362b7c8d75cfa","repo":"goharbor/harbor","slug":"failed-to-check-health-v","errorCode":null,"errorMessage":"failed to check health: %v","messagePattern":"failed to check health: (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/controller/health/checker.go","lineNumber":58,"sourceCode":"\ttimeout time.Duration, statusCode int) health.Checker {\n\treturn health.CheckFunc(func() error {\n\t\treq, err := http.NewRequest(method, url, nil)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create request: %v\", err)\n\t\t}\n\t\tfor key, values := range header {\n\t\t\tfor _, value := range values {\n\t\t\t\treq.Header.Add(key, value)\n\t\t\t}\n\t\t}\n\n\t\tclient := httputil.NewClient(&http.Client{\n\t\t\tTransport: httputil.GetHTTPTransport(),\n\t\t\tTimeout:   timeout,\n\t\t})\n\t\tresp, err := client.Do(req)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to check health: %v\", err)\n\t\t}\n\t\tdefer resp.Body.Close()\n\t\tif resp.StatusCode != statusCode {\n\t\t\tdata, err := io.ReadAll(resp.Body)\n\t\t\tif err != nil {\n\t\t\t\tlog.Debugf(\"failed to read response body: %v\", err)\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"received unexpected status code: %d %s\", resp.StatusCode, string(data))\n\t\t}\n\n\t\treturn nil\n\t})\n}\n\ntype updater struct {\n\tsync.Mutex\n\tstatus error\n}","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/controller/health/checker.go#L40-L76","documentation":"Error \"failed to check health: %v\" thrown in goharbor/harbor.","triggerScenarios":"Thrown at src/controller/health/checker.go:58 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7b2fd08cc568955cca339afeefab27372840d936","analyzedAt":"2026-08-16T00:00:10.961Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}