TechnitiumSoftware/DnsServer · error · FormatException

No 'forwarderAddresses' were configured.

Error message

No 'forwarderAddresses' were configured.

What it means

Thrown in the AdvancedForwardingApp ConfigForwarder constructor when the 'forwarderAddresses' array is missing or null after parsing. ReadArray returns null, and the null-coalescing throw raises FormatException, meaning the forwarder has no upstream to send queries to.

Source

Thrown at Apps/AdvancedForwardingApp/App.cs:878

            #region constructor

            public ConfigForwarder(JsonElement jsonForwarder, Dictionary<string, ConfigProxyServer>? configProxyServers)
            {
                _name = jsonForwarder.GetProperty("name").ToString();

                string? proxyName = jsonForwarder.GetPropertyValue("proxy", null);
                bool dnssecValidation = jsonForwarder.GetPropertyValue("dnssecValidation", true);
                DnsTransportProtocol forwarderProtocol = jsonForwarder.GetPropertyEnumValue("forwarderProtocol", DnsTransportProtocol.Udp);

                ConfigProxyServer? configProxyServer = null;

                if (!string.IsNullOrEmpty(proxyName) && ((configProxyServers is null) || !configProxyServers.TryGetValue(proxyName, out configProxyServer)))
                    throw new FormatException("Proxy server was not defined: " + proxyName);

                _forwarderRecords = jsonForwarder.ReadArray("forwarderAddresses", delegate (string address)
                {
                    return GetForwarderRecord(forwarderProtocol, address, dnssecValidation, configProxyServer);
                }) ?? throw new FormatException("No 'forwarderAddresses' were configured.");
            }

            #endregion

            #region properties

            public string Name
            { get { return _name; } }

            public DnsForwarderRecordData[] ForwarderRecords
            { get { return _forwarderRecords; } }

            #endregion
        }
    }
}

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Add a non-empty 'forwarderAddresses' array to the forwarder object with at least one valid DNS server address.
  2. Verify the key name is exactly 'forwarderAddresses' (plural) and that it is a JSON array.
  3. Confirm each address string is parseable in the configured forwarderProtocol (UDP/TCP/DoH/DoT/DoQ).

Example fix

// before (dnsApp.config)
"forwarders": { "upstream1": { "name": "upstream1", "forwarderProtocol": "Udp" } }
// after
"forwarders": { "upstream1": { "name": "upstream1", "forwarderProtocol": "Udp", "forwarderAddresses": ["1.1.1.1"] } }
Defensive patterns

Strategy: validation

Validate before calling

if (!jsonForwarder.TryGetProperty("forwarderAddresses", out JsonElement fa) || fa.ValueKind != JsonValueKind.Array || fa.GetArrayLength() == 0)
    throw new FormatException($"Forwarder '{jsonForwarder.GetProperty("name")}' must define a non-empty 'forwarderAddresses' array.");

Type guard

static bool HasForwarderAddresses(JsonElement f) => f.TryGetProperty("forwarderAddresses", out JsonElement a) && a.ValueKind == JsonValueKind.Array && a.GetArrayLength() > 0;

Prevention

When it happens

Trigger: A forwarder object omits the 'forwarderAddresses' property, sets it to null, or provides an empty/non-array value, so no forwarder records are produced.

Common situations: Creating a forwarder from a template that lacked addresses; deleting the addresses while keeping the forwarder; misnaming the key (e.g. 'forwarderAddress' singular).

Related errors


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