{"record":{"id":"49739787676f90a9","repo":"HangfireIO/Hangfire","slug":"checkinterval-must-be-either-non-negative-and-equa","errorCode":null,"errorMessage":"CheckInterval must be either non-negative and equal to or less than {ServerWatchdog.MaxServerCheckInterval.Hours} hours","messagePattern":"CheckInterval must be either non-negative and equal to or less than (.+?) hours","errorType":"validation","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"src/Hangfire.Core/Obsolete/ServerWatchdogOptions.cs","lineNumber":55,"sourceCode":"            set\n            {\n                if (value < TimeSpan.Zero || value > ServerWatchdog.MaxServerTimeout)\n                {\n                    throw new ArgumentOutOfRangeException(nameof(value), $\"ServerTimeout must be either non-negative and equal to or less than {ServerWatchdog.MaxServerTimeout.Hours} hours\");\n                }\n\n                _serverTimeout = value;\n            }\n        }\n\n        public TimeSpan CheckInterval\n        {\n            get { return _checkInterval; }\n            set\n            {\n                if (value < TimeSpan.Zero || value > ServerWatchdog.MaxServerCheckInterval)\n                {\n                    throw new ArgumentOutOfRangeException(nameof(value), $\"CheckInterval must be either non-negative and equal to or less than {ServerWatchdog.MaxServerCheckInterval.Hours} hours\");\n\n                };\n                _checkInterval = value;\n            }\n        }\n    }\n}","sourceCodeStart":37,"sourceCodeEnd":62,"githubUrl":"https://github.com/HangfireIO/Hangfire/blob/c236dd0f930f831ec151e436e138ddc429a02a72/src/Hangfire.Core/Obsolete/ServerWatchdogOptions.cs#L37-L62","documentation":"Thrown as ArgumentOutOfRangeException by the obsolete ServerWatchdogOptions.CheckInterval setter when the supplied TimeSpan is negative or exceeds ServerWatchdog.MaxServerCheckInterval (24 hours). CheckInterval governs how often the watchdog scans for timed-out servers; an out-of-range value would either overload storage (too small) or leave dead servers undetected (too large), so the setter rejects it at line 55.","triggerScenarios":"Setting options.CheckInterval to a value where value < TimeSpan.Zero or value > TimeSpan.FromHours(24). E.g. options.CheckInterval = TimeSpan.FromHours(30), or a negative TimeSpan.","commonSituations":"A configuration value parsed with the wrong time unit (minutes interpreted as hours) yielding >24h; a negative TimeSpan from miscomputed offsets; reusing a ServerTimeout value for CheckInterval where they should differ; environment-specific configuration that wasn't validated.","solutions":["Use the non-obsolete BackgroundJobServerOptions.ServerCheckInterval instead, which enforces the same 0..24h bounds and is supported.","Validate/clamp the configured TimeSpan to [TimeSpan.Zero, TimeSpan.FromHours(24)] before assignment.","Parse configuration values with explicit units (TimeSpan.Parse / TimeSpan.FromMinutes) and log them to catch magnitude errors."],"exampleFix":"// before\nwatchdog.CheckInterval = TimeSpan.FromHours(48); // throws\n\n// after\nvar interval = TimeSpan.FromSeconds(cfg.IntervalSeconds);\nserverOptions.ServerCheckInterval = interval > ServerWatchdog.MaxServerCheckInterval\n    ? ServerWatchdog.MaxServerCheckInterval : interval;","handlingStrategy":"validation","validationCode":"var interval = TimeSpan.FromSeconds(cfg.IntervalSeconds);\nif (interval < TimeSpan.Zero || interval > ServerWatchdog.MaxServerCheckInterval)\n    throw new ArgumentOutOfRangeException(nameof(interval));\noptions.CheckInterval = interval;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use BackgroundJobServerOptions.ServerCheckInterval (non-obsolete) instead of ServerWatchdogOptions.","Clamp configured TimeSpans to [Zero, MaxServerCheckInterval] and log the resolved value.","Parse config with explicit units to avoid unit/magnitude errors."],"tags":["argument-out-of-range","configuration","server","watchdog","obsolete"],"backgroundTag":null,"analyzedSha":"c236dd0f930f831ec151e436e138ddc429a02a72","analyzedAt":"2026-08-13T20:27:11.027Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}