{"record":{"id":"0e1d1e6ad7e0d83a","repo":"goharbor/harbor","slug":"received-unexpected-status-code-d-s","errorCode":null,"errorMessage":"received unexpected status code: %d %s","messagePattern":"received unexpected status code: (.+?) (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/controller/health/checker.go","lineNumber":66,"sourceCode":"\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}\n\nfunc (u *updater) Check() error {\n\tu.Lock()\n\tdefer u.Unlock()\n\n\treturn u.status\n}\n","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/controller/health/checker.go#L48-L84","documentation":"Error \"received unexpected status code: %d %s\" thrown in goharbor/harbor.","triggerScenarios":"Thrown at src/controller/health/checker.go:66 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"}