{"record":{"id":"7ee0d3c8472cc1ac","repo":"TechnitiumSoftware/DnsServer","slug":"valid-range-is-from-1-to-1000","errorCode":null,"errorMessage":"Valid range is from 1 to 1000.","messagePattern":"Valid range is from 1 to 1000\\.","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"DnsServerCore/Dns/DnsServer.cs","lineNumber":7554,"sourceCode":"        public int QuicIdleTimeout\n        {\n            get { return _quicIdleTimeout; }\n            set\n            {\n                if ((value < 1000) || (value > 90000))\n                    throw new ArgumentOutOfRangeException(nameof(QuicIdleTimeout), \"Valid range is from 1000 to 90000.\");\n\n                _quicIdleTimeout = value;\n            }\n        }\n\n        public int QuicMaxInboundStreams\n        {\n            get { return _quicMaxInboundStreams; }\n            set\n            {\n                if ((value < 0) || (value > 1000))\n                    throw new ArgumentOutOfRangeException(nameof(QuicMaxInboundStreams), \"Valid range is from 1 to 1000.\");\n\n                _quicMaxInboundStreams = value;\n            }\n        }\n\n        public int ListenBacklog\n        {\n            get { return _listenBacklog; }\n            set { _listenBacklog = value; }\n        }\n\n        public int UdpSendBufferSizeKB\n        {\n            get { return _udpSendBufferSizeKB; }\n            set\n            {\n                if ((value < 8) || (value > 65536))\n                    throw new ArgumentOutOfRangeException(nameof(UdpSendBufferSizeKB), \"Valid range is from 8 KB to 65536 KB.\");","sourceCodeStart":7536,"sourceCodeEnd":7572,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/DnsServerCore/Dns/DnsServer.cs#L7536-L7572","documentation":"Thrown by the QuicMaxInboundStreams setter, which caps how many concurrent bidirectional QUIC streams a remote peer may open against the DNS-over-QUIC listener. IMPORTANT source inconsistency: the guard tests (value < 0) || (value > 1000), so 0 is actually accepted, yet the error message claims the valid range is '1 to 1000'. Treat 0 as effectively permitted by code but discouraged; any negative value or anything above 1000 throws.","triggerScenarios":"Assigning DnsServer.QuicMaxInboundStreams a negative value or a value > 1000. Reached via the settings Web API field or via DnsWebServiceLegacy binary config deserialization. A value of exactly 0 does NOT throw despite the message.","commonSituations":"Misreading the message and assuming 0 is invalid (it passes). Typing a large number like 5000 expecting 'unlimited' streams. Importing a config whose stream limit exceeds the QUIC library cap of 1000.","solutions":["Use a value in 0..1000 (the enforced range); pick a positive value like 100 if you want the documented '1 to 1000' behavior.","If you need effectively-unlimited inbound streams, use the maximum 1000 rather than a larger number.","Be aware 0 is accepted by code — if your downstream logic assumes >= 1, validate explicitly.","Fix the source message to say '0 to 1000' if the < 0 check is intentional, or change the check to (value < 1) if 0 should be rejected."],"exampleFix":"// before\n_dnsServer.QuicMaxInboundStreams = 5000; // throws: > 1000\n\n// after\n_dnsServer.QuicMaxInboundStreams = 1000;  // enforced maximum","handlingStrategy":"validation","validationCode":"static int ClampQuicStreams(int value)\n{\n    if (value < 0) return 0;      // code actually accepts 0\n    if (value > 1000) return 1000;\n    return value;\n}\n\n_dnsServer.QuicMaxInboundStreams = ClampQuicStreams(parsedStreams);","typeGuard":"// NOTE: code enforces 0..1000 even though the message says '1 to 1000'.\nstatic bool IsValidQuicStreams(int value) => value >= 0 && value <= 1000;","tryCatchPattern":"try { _dnsServer.QuicMaxInboundStreams = parsedStreams; }\ncatch (ArgumentOutOfRangeException ex) when (ex.ParamName == nameof(DnsServer.QuicMaxInboundStreams))\n{ _dnsServer.QuicMaxInboundStreams = 100; }","preventionTips":["Remember 0 is accepted by code despite the message.","Cap at 1000 — there is no 'unlimited'.","If you depend on >= 1, validate that yourself after assignment."],"tags":["dns","quic","streams","configuration","argumentoutofrange","source-inconsistency"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}