{"id":"ea70dba3033a0f60","repo":"docker/cli","slug":"failed-to-store-tokens-w","errorCode":null,"errorMessage":"failed to store tokens: %w","messagePattern":"failed to store tokens: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/oauth/manager/manager.go","lineNumber":144,"sourceCode":"\n\t_, _ = fmt.Fprint(w, \"\\nWaiting for authentication in the browser…\\n\")\n\tvar tokenRes api.TokenResponse\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn nil, errors.New(\"login canceled\")\n\tcase err := <-waitForTokenErrChan:\n\t\treturn nil, fmt.Errorf(\"failed waiting for authentication: %w\", err)\n\tcase tokenRes = <-tokenResChan:\n\t}\n\n\tclaims, err := oauth.GetClaims(tokenRes.AccessToken)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse token claims: %w\", err)\n\t}\n\n\terr = m.storeTokensInStore(tokenRes, claims.Domain.Username)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to store tokens: %w\", err)\n\t}\n\n\tpat, err := m.api.GetAutoPAT(ctx, m.audience, tokenRes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &types.AuthConfig{\n\t\tUsername:      claims.Domain.Username,\n\t\tPassword:      pat,\n\t\tServerAddress: registry.IndexServer,\n\t}, nil\n}\n\n// Logout fetches the refresh token from the store and revokes it\n// with the configured oauth tenant. The stored access and refresh\n// tokens are then erased from the store.\n// If the refresh token is not found in the store, an error is not","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/internal/oauth/manager/manager.go#L126-L162","documentation":"Error \"failed to store tokens: %w\" thrown in docker/cli.","triggerScenarios":"Thrown at internal/oauth/manager/manager.go:144 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}