{"id":"975008348518e7b8","repo":"docker/cli","slug":"unexpected-response-from-tenant-s","errorCode":null,"errorMessage":"unexpected response from tenant: %s","messagePattern":"unexpected response from tenant: (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/oauth/api/api.go","lineNumber":91,"sourceCode":"\t}\n\n\tvar state State\n\terr = json.NewDecoder(resp.Body).Decode(&state)\n\tif err != nil {\n\t\treturn state, fmt.Errorf(\"failed to get device code: %w\", err)\n\t}\n\n\treturn state, nil\n}\n\nfunc tryDecodeOAuthError(resp *http.Response) error {\n\tvar body map[string]any\n\tif err := json.NewDecoder(resp.Body).Decode(&body); err == nil {\n\t\tif errorDescription, ok := body[\"error_description\"].(string); ok {\n\t\t\treturn errors.New(errorDescription)\n\t\t}\n\t}\n\treturn errors.New(\"unexpected response from tenant: \" + resp.Status)\n}\n\n// WaitForDeviceToken polls the tenant to get access/refresh tokens for the user.\n// This should be called after GetDeviceCode, and will block until the user has\n// authenticated or we have reached the time limit for authenticating (based on\n// the response from GetDeviceCode).\nfunc (a API) WaitForDeviceToken(ctx context.Context, state State) (TokenResponse, error) {\n\t// Ticker for polling tenant for login – based on the interval\n\t// specified by the tenant response.\n\tticker := time.NewTimer(state.IntervalDuration())\n\tdefer ticker.Stop()\n\t// The tenant tells us for as long as we can poll it for credentials\n\t// while the user logs in through their browser. Timeout if we don't get\n\t// credentials within this period.\n\ttimeout := time.NewTimer(state.ExpiryDuration())\n\tdefer timeout.Stop()\n\n\tfor {","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/internal/oauth/api/api.go#L73-L109","documentation":"Error \"unexpected response from tenant: %s\" thrown in docker/cli.","triggerScenarios":"Thrown at internal/oauth/api/api.go:91 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}