{"record":{"id":"b888fc01cb76e187","repo":"HangfireIO/Hangfire","slug":"job-expiration-check-interval-cannot-be-greater-th","errorCode":null,"errorMessage":"Job expiration check interval cannot be greater than int.MaxValue","messagePattern":"Job expiration check interval cannot be greater than int\\.MaxValue","errorType":"validation","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"src/Hangfire.SqlServer/SqlServerStorageOptions.cs","lineNumber":133,"sourceCode":"            {\n                if (value <= TimeSpan.Zero)\n                {\n                    throw new ArgumentOutOfRangeException(nameof(value), \"Sliding timeout should be greater than zero\");\n                }\n\n                _slidingInvisibilityTimeout = value;\n            }\n        }\n\n        public bool PrepareSchemaIfNecessary { get; set; }\n\n        public TimeSpan JobExpirationCheckInterval \n        {\n            get { return _jobExpirationCheckInterval; } \n            set {\n                if (value.TotalMilliseconds > int.MaxValue)\n                {\n                    throw new ArgumentOutOfRangeException(nameof(value), \"Job expiration check interval cannot be greater than int.MaxValue\");\n                }\n                _jobExpirationCheckInterval = value;\n            }\n        }\n\n        public TimeSpan CountersAggregateInterval { get; set; }\n\n        public int? DashboardJobListLimit { get; set; }\n        public TimeSpan TransactionTimeout { get; set; }\n        public TimeSpan? CommandTimeout { get; set; }\n        public TimeSpan? CommandBatchMaxTimeout { get; set; }\n        public TimeSpan InactiveStateExpirationTimeout { get; set; }\n\n        public string SchemaName\n        {\n            get { return _schemaName; }\n            set\n            {","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/HangfireIO/Hangfire/blob/c236dd0f930f831ec151e436e138ddc429a02a72/src/Hangfire.SqlServer/SqlServerStorageOptions.cs#L115-L151","documentation":"SqlServerStorageOptions.JobExpirationCheckInterval was set to a TimeSpan whose TotalMilliseconds exceeds int.MaxValue (~24.8 days), which is invalid. The property is backed by a timer whose interval is an int, so values beyond that range overflow. An ArgumentOutOfRangeException is thrown.","triggerScenarios":"Setting JobExpirationCheckInterval to a value greater than TimeSpan.FromMilliseconds(int.MaxValue) (~24.85 days); accidentally using TimeSpan.MaxValue or a very large duration.","commonSituations":"Copying a value from a config that expresses the interval in ticks or seconds without conversion; disabling expiration checks by setting an extremely large interval.","solutions":["Use a reasonable interval such as TimeSpan.FromHours(1) (the typical default range).","If you want to minimize expiration runs, cap the value below int.MaxValue milliseconds (~24.8 days).","Validate config-sourced values and clamp before assignment."],"exampleFix":"// before\noptions.JobExpirationCheckInterval = TimeSpan.FromDays(30); // > int.MaxValue ms, throws\n// after\noptions.JobExpirationCheckInterval = TimeSpan.FromHours(1);","handlingStrategy":"validation","validationCode":"TimeSpan interval = /* from config */;\nif (interval.TotalMilliseconds > int.MaxValue)\n    throw new ArgumentOutOfRangeException(nameof(interval), $\"JobExpirationCheckInterval must not exceed int.MaxValue ms (~24.8 days).\");\n\noptions.JobExpirationCheckInterval = interval;","typeGuard":"static bool IsValidExpirationInterval(TimeSpan value) => value.TotalMilliseconds <= int.MaxValue;","tryCatchPattern":null,"preventionTips":["Use reasonable intervals like TimeSpan.FromHours(1).","Never use TimeSpan.MaxValue or multi-day intervals for timer-backed properties.","Validate config-sourced durations before assignment."],"tags":["options","validation","timespan","configuration"],"backgroundTag":null,"analyzedSha":"c236dd0f930f831ec151e436e138ddc429a02a72","analyzedAt":"2026-08-13T20:27:11.027Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}