{"id":"36ab2b3727a8e9eb","repo":"docker/cli","slug":"failed-to-erase-tokens-w","errorCode":null,"errorMessage":"failed to erase tokens: %w","messagePattern":"failed to erase tokens: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/oauth/manager/manager.go","lineNumber":181,"sourceCode":"// returned.\nfunc (m *OAuthManager) Logout(ctx context.Context) error {\n\trefreshConfig, err := m.store.Get(refreshTokenKey)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif refreshConfig.Password == \"\" {\n\t\treturn nil\n\t}\n\tparts := strings.Split(refreshConfig.Password, \"..\")\n\tif len(parts) != 2 {\n\t\t// the token wasn't stored by the CLI, so don't revoke it\n\t\t// or erase it from the store/error\n\t\treturn nil\n\t}\n\t// erase the token from the store first, that way\n\t// if the revoke fails, the user can try to logout again\n\tif err := m.eraseTokensFromStore(); err != nil {\n\t\treturn fmt.Errorf(\"failed to erase tokens: %w\", err)\n\t}\n\tif err := m.api.RevokeToken(ctx, parts[0]); err != nil {\n\t\treturn fmt.Errorf(\"credentials erased successfully, but there was a failure to revoke the OAuth refresh token with the tenant: %w\", err)\n\t}\n\treturn nil\n}\n\nconst (\n\taccessTokenKey  = registry.IndexServer + \"access-token\"\n\trefreshTokenKey = registry.IndexServer + \"refresh-token\"\n)\n\nfunc (m *OAuthManager) storeTokensInStore(tokens api.TokenResponse, username string) error {\n\treturn errors.Join(\n\t\tm.store.Store(types.AuthConfig{\n\t\t\tUsername:      username,\n\t\t\tPassword:      tokens.AccessToken,\n\t\t\tServerAddress: accessTokenKey,","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/internal/oauth/manager/manager.go#L163-L199","documentation":"Error \"failed to erase tokens: %w\" thrown in docker/cli.","triggerScenarios":"Thrown at internal/oauth/manager/manager.go:181 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}