{"record":{"id":"c0384c2d881ac8d0","repo":"TechnitiumSoftware/DnsServer","slug":"no-forwarderaddresses-were-configured","errorCode":null,"errorMessage":"No 'forwarderAddresses' were configured.","messagePattern":"No 'forwarderAddresses' were configured\\.","errorType":"exception","errorClass":"FormatException","httpStatus":null,"severity":"error","filePath":"Apps/AdvancedForwardingApp/App.cs","lineNumber":878,"sourceCode":"            #region constructor\n\n            public ConfigForwarder(JsonElement jsonForwarder, Dictionary<string, ConfigProxyServer>? configProxyServers)\n            {\n                _name = jsonForwarder.GetProperty(\"name\").ToString();\n\n                string? proxyName = jsonForwarder.GetPropertyValue(\"proxy\", null);\n                bool dnssecValidation = jsonForwarder.GetPropertyValue(\"dnssecValidation\", true);\n                DnsTransportProtocol forwarderProtocol = jsonForwarder.GetPropertyEnumValue(\"forwarderProtocol\", DnsTransportProtocol.Udp);\n\n                ConfigProxyServer? configProxyServer = null;\n\n                if (!string.IsNullOrEmpty(proxyName) && ((configProxyServers is null) || !configProxyServers.TryGetValue(proxyName, out configProxyServer)))\n                    throw new FormatException(\"Proxy server was not defined: \" + proxyName);\n\n                _forwarderRecords = jsonForwarder.ReadArray(\"forwarderAddresses\", delegate (string address)\n                {\n                    return GetForwarderRecord(forwarderProtocol, address, dnssecValidation, configProxyServer);\n                }) ?? throw new FormatException(\"No 'forwarderAddresses' were configured.\");\n            }\n\n            #endregion\n\n            #region properties\n\n            public string Name\n            { get { return _name; } }\n\n            public DnsForwarderRecordData[] ForwarderRecords\n            { get { return _forwarderRecords; } }\n\n            #endregion\n        }\n    }\n}\n","sourceCodeStart":860,"sourceCodeEnd":895,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/Apps/AdvancedForwardingApp/App.cs#L860-L895","documentation":"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.","triggerScenarios":"A forwarder object omits the 'forwarderAddresses' property, sets it to null, or provides an empty/non-array value, so no forwarder records are produced.","commonSituations":"Creating a forwarder from a template that lacked addresses; deleting the addresses while keeping the forwarder; misnaming the key (e.g. 'forwarderAddress' singular).","solutions":["Add a non-empty 'forwarderAddresses' array to the forwarder object with at least one valid DNS server address.","Verify the key name is exactly 'forwarderAddresses' (plural) and that it is a JSON array.","Confirm each address string is parseable in the configured forwarderProtocol (UDP/TCP/DoH/DoT/DoQ)."],"exampleFix":"// before (dnsApp.config)\n\"forwarders\": { \"upstream1\": { \"name\": \"upstream1\", \"forwarderProtocol\": \"Udp\" } }\n// after\n\"forwarders\": { \"upstream1\": { \"name\": \"upstream1\", \"forwarderProtocol\": \"Udp\", \"forwarderAddresses\": [\"1.1.1.1\"] } }","handlingStrategy":"validation","validationCode":"if (!jsonForwarder.TryGetProperty(\"forwarderAddresses\", out JsonElement fa) || fa.ValueKind != JsonValueKind.Array || fa.GetArrayLength() == 0)\n    throw new FormatException($\"Forwarder '{jsonForwarder.GetProperty(\"name\")}' must define a non-empty 'forwarderAddresses' array.\");","typeGuard":"static bool HasForwarderAddresses(JsonElement f) => f.TryGetProperty(\"forwarderAddresses\", out JsonElement a) && a.ValueKind == JsonValueKind.Array && a.GetArrayLength() > 0;","tryCatchPattern":null,"preventionTips":["Always include a non-empty 'forwarderAddresses' array on each forwarder.","Use the exact plural key name and ensure values are parseable in the chosen forwarderProtocol.","Validate forwarder objects against a schema before saving."],"tags":["csharp","config","json","schema","technitium","advanced-forwarding-app"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}