{"record":{"id":"ae7ab4a5036f7b41","repo":"TechnitiumSoftware/DnsServer","slug":"invalid-application-configuration","errorCode":null,"errorMessage":"Invalid application configuration.","messagePattern":"Invalid application configuration\\.","errorType":"exception","errorClass":"DnsClientException","httpStatus":null,"severity":"error","filePath":"Apps/LogExporterApp/App.cs","lineNumber":102,"sourceCode":"                _disposed = true;\n            }\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            _config = AppConfig.Deserialize(config);\n\n            if (_config is null)\n                throw new DnsClientException(\"Invalid application configuration.\");\n\n            if (_config.FileTarget!.Enabled)\n            {\n                _exportManager.RemoveStrategy(typeof(FileExportStrategy));\n                _exportManager.AddStrategy(new FileExportStrategy(_config.FileTarget!.Path));\n            }\n            else\n            {\n                _exportManager.RemoveStrategy(typeof(FileExportStrategy));\n            }\n\n            if (_config.HttpTarget!.Enabled)\n            {\n                _exportManager.RemoveStrategy(typeof(HttpExportStrategy));\n                _exportManager.AddStrategy(new HttpExportStrategy(_config.HttpTarget.Endpoint, _config.HttpTarget.Headers));\n            }\n            else\n            {","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/Apps/LogExporterApp/App.cs#L84-L120","documentation":"Thrown by LogExporterApp.InitializeAsync when AppConfig.Deserialize(config) returns null. The config string was non-null but could not be deserialised into a valid AppConfig, so the app refuses to start and raises DnsClientException. It guards the rest of initialisation from a null configuration object.","triggerScenarios":"LogExporterApp is loaded with a config string that is syntactically present but semantically invalid for AppConfig — malformed JSON, missing required sections, or a schema the deserialiser maps to null. If config itself were null a different exception (InvalidOperationException) would fire first.","commonSituations":"Editing the LogExporterApp config by hand and breaking the JSON structure, a truncated/copy-pasted config, or a version mismatch where the running build expects fields the config does not provide.","solutions":["Open the LogExporterApp config string and validate it parses as JSON (no trailing commas, balanced braces).","Ensure required AppConfig fields (fileTarget/httpTarget/syslogTarget blocks) are present and well-formed.","Compare against the default/example LogExporterApp config and fix structural differences.","Reload the app and confirm no 'Invalid application configuration' error."],"exampleFix":"// before\n{ \"fileTarget\" { \"enabled\": true, \"path\": \"/var/log/dns\" } }\n// after\n{ \"fileTarget\": { \"enabled\": true, \"path\": \"/var/log/dns\" } }","handlingStrategy":"validation","validationCode":"if (string.IsNullOrWhiteSpace(config)) throw new ConfigValidationException(\"LogExporterApp config is empty.\");\nvar parsed = AppConfig.Deserialize(config);\nif (parsed is null) throw new ConfigValidationException(\"LogExporterApp config did not deserialize — validate the JSON structure.\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Lint LogExporterApp config JSON before deploy.","Keep a known-good example config to diff against.","Validate required target blocks (fileTarget/httpTarget/syslogTarget) are objects."],"tags":["config","log-exporter","deserialization","startup"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}