{"record":{"id":"6fda40fa325ee633","repo":"TechnitiumSoftware/DnsServer","slug":"dnsbl-block-list-type-is-not-supported-type","errorCode":null,"errorMessage":"DNSBL block list type is not supported: {type}","messagePattern":"DNSBL block list type is not supported: (.+?)","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"Apps/DnsBlockListApp/App.cs","lineNumber":147,"sourceCode":"            if ((_dnsBlockLists is not null) && _dnsBlockLists.TryGetValue(name, out BlockList? existingBlockList) && (existingBlockList.Type == type))\n            {\n                existingBlockList.ReloadConfig(jsonBlockList);\n                blockList = existingBlockList;\n            }\n            else\n            {\n                switch (type)\n                {\n                    case BlockListType.Ip:\n                        blockList = new IpBlockList(_dnsServer!, jsonBlockList);\n                        break;\n\n                    case BlockListType.Domain:\n                        blockList = new DomainBlockList(_dnsServer!, jsonBlockList);\n                        break;\n\n                    default:\n                        throw new NotSupportedException(\"DNSBL block list type is not supported: \" + type.ToString());\n                }\n            }\n\n            return new Tuple<string, BlockList>(blockList.Name, blockList);\n        }\n\n        #endregion\n\n        #region public\n\n        public Task InitializeAsync(IDnsServer dnsServer, string? config)\n        {\n            _dnsServer = dnsServer;\n\n            if (config is null)\n                throw new InvalidOperationException();\n\n            using JsonDocument jsonDocument = JsonDocument.Parse(config, _jsonParseOptions);","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/Apps/DnsBlockListApp/App.cs#L129-L165","documentation":"Thrown by the DnsBlockListApp switch statement that constructs a block list from a JSON config entry. The internal BlockListType enum only defines Ip (1) and Domain (2); any other parsed type value reaches the default branch and throws NotSupportedException. It means the config supplied a 'type' field the DNSBL app cannot map to a concrete BlockList implementation.","triggerScenarios":"A DNSBL config entry whose JSON 'type' property holds a value that is not 'Ip' or 'Domain' (case-insensitive enum parse). This happens after GetPropertyEnumValue('type', BlockListType.Ip) runs at App.cs:127 — if the property exists but fails to parse to the enum, the resulting value falls through to the switch default.","commonSituations":"Typo in the block list 'type' string (e.g. 'domainname', 'IPs', 'host'), a copy-paste from another app's config, an old config written for a newer server version that added a third type, or a numeric value that does not match enum ordinals.","solutions":["Open the DnsBlockListApp JSON config and set each entry's 'type' to exactly 'Ip' or 'Domain' (case-insensitive).","If you want to block hostnames, use 'Domain'; for IP-based lists use 'Ip'. Remove any unknown type values.","Restart/reload the app and confirm the server log shows no further 'block list type' errors.","If you authored a custom BlockList subclass, register it in the switch before the default branch."],"exampleFix":"// before (config)\n{ \"type\": \"hostname\", \"url\": \"https://example.com/list\" }\n// after\n{ \"type\": \"Domain\", \"url\": \"https://example.com/list\" }","handlingStrategy":"validation","validationCode":"var allowed = new[] { \"ip\", \"domain\" };\nstring raw = jsonBlockList.TryGetProperty(\"type\", out var t) ? t.GetString() ?? \"ip\" : \"ip\";\nif (!allowed.Contains(raw, StringComparer.OrdinalIgnoreCase))\n    throw new ConfigValidationException($\"DNSBL entry '{name}': 'type' must be one of {string.Join(\", \", allowed)}.\");","typeGuard":"static bool IsValidBlockListType(string? v) => v is not null && (v.Equals(\"Ip\", StringComparison.OrdinalIgnoreCase) || v.Equals(\"Domain\", StringComparison.OrdinalIgnoreCase));","tryCatchPattern":null,"preventionTips":["Validate each DNSBL config entry against the known type set before calling the app loader.","Treat unknown enum values as config errors at load time, not runtime query time.","Keep a JSON schema for app configs and run it on deploy."],"tags":["config","dnsbl","enum-switch","notsupported"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}