{"id":"e395d34de505973a","repo":"serilog/serilog","slug":"the-retry-time-limit-must-not-be-negative","errorCode":null,"errorMessage":"The retry time limit must not be negative.","messagePattern":"The retry time limit must not be negative\\.","errorType":"validation","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"src/Serilog/Core/Sinks/Batching/BatchingSink.cs","lineNumber":67,"sourceCode":"    Task<bool>? _cachedWaitToRead;\n    ILoggingFailureListener _failureListener = SelfLog.FailureListener;\n\n    /// <summary>\n    /// Construct a <see cref=\"BatchingSink\"/>.\n    /// </summary>\n    /// <param name=\"batchedSink\">A <see cref=\"IBatchedLogEventSink\"/> to send log event batches to. Batches and empty\n    /// batch notifications will not be sent concurrently. When the <see cref=\"BatchingSink\"/> is disposed,\n    /// it will dispose this object if possible.</param>\n    /// <param name=\"options\">Options controlling behavior of the sink.</param>\n    public BatchingSink(IBatchedLogEventSink batchedSink, BatchingOptions options)\n    {\n        if (options == null) throw new ArgumentNullException(nameof(options));\n        if (options.BatchSizeLimit <= 0)\n            throw new ArgumentOutOfRangeException(nameof(options), \"The batch size limit must be greater than zero.\");\n        if (options.BufferingTimeLimit <= TimeSpan.Zero)\n            throw new ArgumentOutOfRangeException(nameof(options), \"The buffering time limit must be greater than zero.\");\n        if (options.RetryTimeLimit < TimeSpan.Zero)\n            throw new ArgumentOutOfRangeException(nameof(options), \"The retry time limit must not be negative.\");\n\n        _targetSink = batchedSink ?? throw new ArgumentNullException(nameof(batchedSink));\n        _batchSizeLimit = options.BatchSizeLimit;\n        _queue = options.QueueLimit is { } limit\n            ? Channel.CreateBounded<LogEvent>(new BoundedChannelOptions(limit) { SingleReader = true })\n            : Channel.CreateUnbounded<LogEvent>(new UnboundedChannelOptions { SingleReader = true });\n        _batchScheduler = new FailureAwareBatchScheduler(options.BufferingTimeLimit, options.RetryTimeLimit);\n        _eagerlyEmitFirstEvent = options.EagerlyEmitFirstEvent;\n        _waitForShutdownSignal = Task.Delay(Timeout.InfiniteTimeSpan, _shutdownSignal.Token)\n            .ContinueWith(e => e.Exception, TaskContinuationOptions.OnlyOnFaulted);\n\n        // The conditional here is no longer required in .NET 8+ (dotnet/runtime#82912)\n        using (ExecutionContext.IsFlowSuppressed() ? (IDisposable?)null : ExecutionContext.SuppressFlow())\n        {\n            _runLoop = Task.Run(LoopAsync);\n        }\n    }\n","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/serilog/serilog/blob/49b5339ce85385dc52d4d8e8f2b8308becf23506/src/Serilog/Core/Sinks/Batching/BatchingSink.cs#L49-L85","documentation":"Error \"The retry time limit must not be negative.\" thrown in serilog/serilog.","triggerScenarios":"Thrown at src/Serilog/Core/Sinks/Batching/BatchingSink.cs:67 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"49b5339ce85385dc52d4d8e8f2b8308becf23506","analyzedAt":"2026-08-04T15:52:35.488Z","schemaVersion":2}