{"record":{"id":"e10385e18caced44","repo":"goharbor/harbor","slug":"login-to-dockerhub-error-s","errorCode":null,"errorMessage":"login to dockerhub error: %s","messagePattern":"login to dockerhub error: (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/pkg/reg/adapter/dockerhub/client.go","lineNumber":101,"sourceCode":"\trequest, err := http.NewRequest(http.MethodPost, baseURL+loginPath, bytes.NewReader(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\trequest.Header.Set(\"Content-Type\", \"application/json\")\n\n\tresp, err := c.client.Do(request)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tbody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif resp.StatusCode/100 != 2 {\n\t\treturn fmt.Errorf(\"login to dockerhub error: %s\", string(body))\n\t}\n\n\ttoken := &TokenResp{}\n\tif err = json.Unmarshal(body, token); err != nil {\n\t\treturn fmt.Errorf(\"unmarshal token response error: %v\", err)\n\t}\n\n\tc.token = token.AccessToken\n\t// Tokens issued by /v2/auth/token expire after 10 minutes; refresh 1 minute\n\t// early to avoid using a token that is about to expire.\n\tc.tokenExpiry = time.Now().Add(9 * time.Minute)\n\treturn nil\n}\n\n// ensureToken refreshes the bearer token when it has expired or is close to\n// expiring. It is a no-op for anonymous (unauthenticated) clients.\nfunc (c *Client) ensureToken() error {\n\tif len(c.credential.Identifier) == 0 {","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/pkg/reg/adapter/dockerhub/client.go#L83-L119","documentation":"Error \"login to dockerhub error: %s\" thrown in goharbor/harbor.","triggerScenarios":"Thrown at src/pkg/reg/adapter/dockerhub/client.go:101 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"}