TechnitiumSoftware/DnsServer · error · NotSupportedException

DNSBL block list type is not supported: {type}

Error message

DNSBL block list type is not supported: {type}

What it means

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.

Source

Thrown at Apps/DnsBlockListApp/App.cs:147

            if ((_dnsBlockLists is not null) && _dnsBlockLists.TryGetValue(name, out BlockList? existingBlockList) && (existingBlockList.Type == type))
            {
                existingBlockList.ReloadConfig(jsonBlockList);
                blockList = existingBlockList;
            }
            else
            {
                switch (type)
                {
                    case BlockListType.Ip:
                        blockList = new IpBlockList(_dnsServer!, jsonBlockList);
                        break;

                    case BlockListType.Domain:
                        blockList = new DomainBlockList(_dnsServer!, jsonBlockList);
                        break;

                    default:
                        throw new NotSupportedException("DNSBL block list type is not supported: " + type.ToString());
                }
            }

            return new Tuple<string, BlockList>(blockList.Name, blockList);
        }

        #endregion

        #region public

        public Task InitializeAsync(IDnsServer dnsServer, string? config)
        {
            _dnsServer = dnsServer;

            if (config is null)
                throw new InvalidOperationException();

            using JsonDocument jsonDocument = JsonDocument.Parse(config, _jsonParseOptions);

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Open the DnsBlockListApp JSON config and set each entry's 'type' to exactly 'Ip' or 'Domain' (case-insensitive).
  2. If you want to block hostnames, use 'Domain'; for IP-based lists use 'Ip'. Remove any unknown type values.
  3. Restart/reload the app and confirm the server log shows no further 'block list type' errors.
  4. If you authored a custom BlockList subclass, register it in the switch before the default branch.

Example fix

// before (config)
{ "type": "hostname", "url": "https://example.com/list" }
// after
{ "type": "Domain", "url": "https://example.com/list" }
Defensive patterns

Strategy: validation

Validate before calling

var allowed = new[] { "ip", "domain" };
string raw = jsonBlockList.TryGetProperty("type", out var t) ? t.GetString() ?? "ip" : "ip";
if (!allowed.Contains(raw, StringComparer.OrdinalIgnoreCase))
    throw new ConfigValidationException($"DNSBL entry '{name}': 'type' must be one of {string.Join(", ", allowed)}.");

Type guard

static bool IsValidBlockListType(string? v) => v is not null && (v.Equals("Ip", StringComparison.OrdinalIgnoreCase) || v.Equals("Domain", StringComparison.OrdinalIgnoreCase));

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of TechnitiumSoftware/DnsServer@d0484b6c1e (2026-08-13). Data as JSON: /api/errors/6fda40fa325ee633. Report an issue: GitHub.