{"record":{"id":"501d33064459df2f","repo":"goharbor/harbor","slug":"http-status-code-d-body-s","errorCode":null,"errorMessage":"http status code: %d, body: %s","messagePattern":"http status code: (.+?), body: (.+?)","errorType":"http","errorClass":"lib/errors.Error","httpStatus":null,"severity":"error","filePath":"src/pkg/registry/auth/bearer/authorizer.go","lineNumber":142,"sourceCode":"\n\tresp, err := a.client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif resp.StatusCode != http.StatusOK {\n\t\tcode := errors.GeneralCode\n\t\tswitch resp.StatusCode {\n\t\tcase http.StatusUnauthorized:\n\t\t\tcode = errors.UnAuthorizedCode\n\t\tcase http.StatusForbidden:\n\t\t\tcode = errors.ForbiddenCode\n\t\t}\n\t\treturn nil, errors.New(nil).WithCode(code).\n\t\t\tWithMessagef(\"http status code: %d, body: %s\", resp.StatusCode, string(body))\n\t}\n\ttoken := &token{}\n\tif err = json.Unmarshal(body, token); err != nil {\n\t\treturn nil, err\n\t}\n\tif len(token.Token) == 0 && len(token.AccessToken) > 0 {\n\t\ttoken.Token = token.AccessToken\n\t}\n\treturn token, nil\n}\n","sourceCodeStart":124,"sourceCodeEnd":154,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/pkg/registry/auth/bearer/authorizer.go#L124-L154","documentation":"Error \"http status code: %d, body: %s\" thrown in goharbor/harbor.","triggerScenarios":"Thrown at src/pkg/registry/auth/bearer/authorizer.go:142 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"}