{"record":{"id":"6783ae2d60c10577","repo":"TechnitiumSoftware/DnsServer","slug":"unknown-status-value-was-received-status","errorCode":null,"errorMessage":"Unknown status value was received: {status}","messagePattern":"Unknown status value was received: (.+?)","errorType":"exception","errorClass":"HttpApiClientException","httpStatus":null,"severity":"error","filePath":"DnsServerCore.HttpApi/HttpApiClient.cs","lineNumber":161,"sourceCode":"\n                case \"invalid-token\":\n                    {\n                        if (rootElement.TryGetProperty(\"errorMessage\", out JsonElement jsonErrorMessage))\n                            throw new InvalidTokenHttpApiClientException(jsonErrorMessage.GetString()!);\n\n                        throw new InvalidTokenHttpApiClientException();\n                    }\n\n                case \"2fa-required\":\n                    {\n                        if (rootElement.TryGetProperty(\"errorMessage\", out JsonElement jsonErrorMessage))\n                            throw new TwoFactorAuthRequiredHttpApiClientException(jsonErrorMessage.GetString()!);\n\n                        throw new TwoFactorAuthRequiredHttpApiClientException();\n                    }\n\n                default:\n                    throw new HttpApiClientException(\"Unknown status value was received: \" + status);\n            }\n        }\n\n        #endregion\n\n        #region public\n\n        public async Task<SessionInfo> LoginAsync(string username, string password, string? totp = null, bool includeInfo = false, CancellationToken cancellationToken = default)\n        {\n            if (_loggedIn)\n                throw new HttpApiClientException(\"Already logged in.\");\n\n            HttpRequestMessage httpRequest = new HttpRequestMessage(HttpMethod.Post, new Uri(_serverUrl, $\"api/user/login\"));\n\n            Dictionary<string, string> parameters = new Dictionary<string, string>\n            {\n                { \"user\", username },\n                { \"pass\", password },","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/DnsServerCore.HttpApi/HttpApiClient.cs#L143-L179","documentation":"CheckResponseStatus switches on the lowercased 'status' string and handles 'ok', 'error', 'invalid-token', and '2fa-required'. This HttpApiClientException fires for any other status value, indicating the server spoke a status dialect the client does not understand (version skew or a malformed response).","triggerScenarios":"The server returns JSON with a 'status' field whose value is not one of ok/error/invalid-token/2fa-required — e.g. a newer server emitting 'partial', 'pending', or a typo'd status.","commonSituations":"Client library is older than the server (or vice versa) introducing new status codes; a forked/customized server added statuses the stock client does not recognise.","solutions":["Upgrade the HttpApiClient package to match the deployed DNS Server version.","Log the received 'status' value to identify what the server sent.","If running a custom server build, align its status vocabulary with the client's switch cases."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"static readonly HashSet<string> KnownStatuses = new()\n{\n    \"ok\", \"error\", \"invalid-token\", \"2fa-required\"\n};\n\n// after parsing rootElement:\nif (rootElement.TryGetProperty(\"status\", out var s)\n    && !KnownStatuses.Contains(s.GetString()?.ToLowerInvariant() ?? \"\"))\n{\n    // version skew: client cannot handle this status\n}","tryCatchPattern":"catch (HttpApiClientException ex) when (ex.Message.StartsWith(\"Unknown status value was received\"))\n{\n    logger.LogError(\"Version skew: server sent an unrecognised status. Upgrade HttpApiClient.\");\n}","preventionTips":["Pin HttpApiClient and DNS Server to compatible release versions.","Monitor server release notes for new status codes.","Log unhandled statuses during staging before production rollout."],"tags":["http-api","client","json","version-skew"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}