{"id":"237668645fb0262a","repo":"docker/cli","slug":"failed-to-decode-response-w","errorCode":null,"errorMessage":"failed to decode response: %w","messagePattern":"failed to decode response: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/oauth/api/api.go","lineNumber":184,"sourceCode":"\t\t\"device_code\": {state.DeviceCode},\n\t}\n\toauthTokenURL := a.TenantURL + \"/oauth/token\"\n\n\tresp, err := postForm(ctx, oauthTokenURL, strings.NewReader(data.Encode()))\n\tif err != nil {\n\t\treturn TokenResponse{}, fmt.Errorf(\"failed to get tokens: %w\", err)\n\t}\n\tdefer func() {\n\t\t_ = resp.Body.Close()\n\t}()\n\n\t// this endpoint returns a 403 with an `authorization_pending` error until the\n\t// user has authenticated, so we don't check the status code here and instead\n\t// decode the response and check for the error.\n\tvar res TokenResponse\n\terr = json.NewDecoder(resp.Body).Decode(&res)\n\tif err != nil {\n\t\treturn res, fmt.Errorf(\"failed to decode response: %w\", err)\n\t}\n\n\treturn res, nil\n}\n\n// RevokeToken revokes a refresh token with the tenant so that it can no longer\n// be used to get new tokens.\nfunc (a API) RevokeToken(ctx context.Context, refreshToken string) error {\n\tdata := url.Values{\n\t\t\"client_id\": {a.ClientID},\n\t\t\"token\":     {refreshToken},\n\t}\n\n\trevokeURL := a.TenantURL + \"/oauth/revoke\"\n\tresp, err := postForm(ctx, revokeURL, strings.NewReader(data.Encode()))\n\tif err != nil {\n\t\treturn err\n\t}","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/internal/oauth/api/api.go#L166-L202","documentation":"Error \"failed to decode response: %w\" thrown in docker/cli.","triggerScenarios":"Thrown at internal/oauth/api/api.go:184 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}