{"record":{"id":"2c946595e8dc478a","repo":"abpframework/abp","slug":"error-remote-server-returns-response-statuscode-2c9465","errorCode":null,"errorMessage":"ERROR: Remote server returns '{response.StatusCode}'","messagePattern":"ERROR: Remote server returns '(.+?)'","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/AbpIoApiKeyService.cs","lineNumber":61,"sourceCode":"\n        if (invalidateCache)\n        {\n            _apiKeyResult = null;\n        }\n\n        if (_apiKeyResult != null)\n        {\n            return _apiKeyResult;\n        }\n\n        var url = $\"{CliUrls.AccountAbpIo}api/license/api-key\";\n        var client = _cliHttpClientFactory.CreateClient();\n\n        using (var response = await client.GetHttpResponseMessageWithRetryAsync(url, CancellationTokenProvider.Token, _logger))\n        {\n            if (!response.IsSuccessStatusCode)\n            {\n                throw new Exception($\"ERROR: Remote server returns '{response.StatusCode}'\");\n            }\n\n            await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(response);\n\n            var responseContent = await response.Content.ReadAsStringAsync();\n            return JsonSerializer.Deserialize<DeveloperApiKeyResult>(responseContent);\n        }\n\n    }\n}\n","sourceCodeStart":43,"sourceCodeEnd":72,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/AbpIoApiKeyService.cs#L43-L72","documentation":"Thrown by `AbpIoApiKeyService.GetApiKeyAsync` when the HTTP request to the ABP account API (`api/license/api-key`) returns a non-success status code. It is a raw `Exception` (not `CliUsageException`), surfacing the status code verbatim. This is used to fetch the developer API key tied to your ABP account/license.","triggerScenarios":"Calling `abp login` or any flow that resolves a developer API key while the remote account service responds with an error status (401, 403, 5xx). The check happens before the body is parsed.","commonSituations":"Not logged in or expired session; ABP commercial license inactive/expired; transient outage of `account.abp.io`; corporate proxy/firewall returning a blocking status code; region blocking.","solutions":["Run `abp login <username>` with valid ABP account credentials, then retry.","Check your license status at abp.io and confirm it is active and covers the version you are requesting.","If the status is 5xx, wait and retry; check status.abp.io or community channels for an outage.","Verify network/proxy settings are not intercepting the request (check `abp config` proxy values)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Pre-flight: confirm reachable and authenticated before requesting the API key.\nvar client = httpClientFactory.CreateClient();\nusing var probe = await client.GetAsync(\"https://account.abp.io/api/license/api-key\", token);\nif (!probe.IsSuccessStatusCode)\n    Console.Error.WriteLine($\"Cannot reach API key endpoint (HTTP {probe.StatusCode}). Run `abp login` first.\");","typeGuard":null,"tryCatchPattern":"for (int attempt = 0; attempt < 3; attempt++)\n{\n    try { return await apiKeyService.GetApiKeyAsync(); }\n    catch (Exception ex) when (ex.Message.Contains(\"Remote server returns\") && attempt < 2)\n    {\n        await Task.Delay(TimeSpan.FromSeconds(Math.Pow(2, attempt)));\n    }\n}\nthrow;","preventionTips":["Run `abp login` and verify the session before any flow that needs the API key.","Keep the commercial license active; monitor expiry.","Configure proxy settings if behind a corporate network."],"tags":["cli","licensing","network","authentication","abp-io"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}