serilog/serilog · error · ArgumentOutOfRangeException
The retry time limit must not be negative.
Error message
The retry time limit must not be negative.
What it means
Error "The retry time limit must not be negative." thrown in serilog/serilog.
Source
Thrown at src/Serilog/Core/Sinks/Batching/BatchingSink.cs:67
Task<bool>? _cachedWaitToRead;
ILoggingFailureListener _failureListener = SelfLog.FailureListener;
/// <summary>
/// Construct a <see cref="BatchingSink"/>.
/// </summary>
/// <param name="batchedSink">A <see cref="IBatchedLogEventSink"/> to send log event batches to. Batches and empty
/// batch notifications will not be sent concurrently. When the <see cref="BatchingSink"/> is disposed,
/// it will dispose this object if possible.</param>
/// <param name="options">Options controlling behavior of the sink.</param>
public BatchingSink(IBatchedLogEventSink batchedSink, BatchingOptions options)
{
if (options == null) throw new ArgumentNullException(nameof(options));
if (options.BatchSizeLimit <= 0)
throw new ArgumentOutOfRangeException(nameof(options), "The batch size limit must be greater than zero.");
if (options.BufferingTimeLimit <= TimeSpan.Zero)
throw new ArgumentOutOfRangeException(nameof(options), "The buffering time limit must be greater than zero.");
if (options.RetryTimeLimit < TimeSpan.Zero)
throw new ArgumentOutOfRangeException(nameof(options), "The retry time limit must not be negative.");
_targetSink = batchedSink ?? throw new ArgumentNullException(nameof(batchedSink));
_batchSizeLimit = options.BatchSizeLimit;
_queue = options.QueueLimit is { } limit
? Channel.CreateBounded<LogEvent>(new BoundedChannelOptions(limit) { SingleReader = true })
: Channel.CreateUnbounded<LogEvent>(new UnboundedChannelOptions { SingleReader = true });
_batchScheduler = new FailureAwareBatchScheduler(options.BufferingTimeLimit, options.RetryTimeLimit);
_eagerlyEmitFirstEvent = options.EagerlyEmitFirstEvent;
_waitForShutdownSignal = Task.Delay(Timeout.InfiniteTimeSpan, _shutdownSignal.Token)
.ContinueWith(e => e.Exception, TaskContinuationOptions.OnlyOnFaulted);
// The conditional here is no longer required in .NET 8+ (dotnet/runtime#82912)
using (ExecutionContext.IsFlowSuppressed() ? (IDisposable?)null : ExecutionContext.SuppressFlow())
{
_runLoop = Task.Run(LoopAsync);
}
}
View on GitHub (pinned to 49b5339ce8)
When it happens
Trigger: Thrown at src/Serilog/Core/Sinks/Batching/BatchingSink.cs:67 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of serilog/serilog@49b5339ce8 (2026-08-04).
Data as JSON: /data/errors/e395d34de505973a.json.
Report an issue: GitHub.