microsoft/garnet · error · Exception
InitialIORecordSize value '{InitialIORecordSize}' ({sizeInBy
Error message
InitialIORecordSize value '{InitialIORecordSize}' ({sizeInBytes} bytes) must be positive. What it means
After parsing, InitialIORecordSize must be strictly positive. A value of 0 (which parses fine as a bare integer) is meaningless as an initial IO read size, so GetInitialIORecordSizeBytes() rejects it. Note that negative values fail earlier at the parse step (error 197) because TryParseSize rejects the leading minus sign.
Source
Thrown at libs/server/Servers/GarnetServerOptions.cs:952
return (int)sizeInBytes;
}
/// <summary>
/// Parse <see cref="InitialIORecordSize"/> as a byte count.
/// Returns <see cref="KVSettings.UseDefaultInitialIORecordSize"/> if the value is null or empty (use default).
/// </summary>
/// <returns>The byte value used for <c>KVSettings.InitialIORecordSize</c>, or <see cref="KVSettings.UseDefaultInitialIORecordSize"/> if unset.</returns>
/// <exception cref="Exception">Thrown when the value cannot be parsed.</exception>
public int GetInitialIORecordSizeBytes()
{
if (string.IsNullOrEmpty(InitialIORecordSize))
return KVSettings.UseDefaultInitialIORecordSize;
if (!TryParseSize(InitialIORecordSize, out var sizeInBytes))
throw new Exception($"Unable to parse {nameof(InitialIORecordSize)} value '{InitialIORecordSize}'. Expected a memory size string (e.g. '4k', '8k').");
if (sizeInBytes <= 0)
throw new Exception($"{nameof(InitialIORecordSize)} value '{InitialIORecordSize}' ({sizeInBytes} bytes) must be positive.");
if (sizeInBytes > 1L << PageSizeBits())
throw new Exception($"{nameof(InitialIORecordSize)} value '{InitialIORecordSize}' ({sizeInBytes} bytes) exceeds the page size ({1L << PageSizeBits()} bytes).");
return (int)sizeInBytes;
}
/// <summary>
/// Get AOF settings
/// </summary>
/// <param name="dbId">DB ID</param>
/// <param name="tsavoriteLogSettings">Tsavorite log settings</param>
public void GetAofSettings(int dbId, out TsavoriteLogSettings[] tsavoriteLogSettings)
{
// Validate sizes up-front (invariant across sublogs) so we don't allocate devices
// or commit managers that would need to be disposed if validation fails.
var memorySizeBits = AofMemorySizeBits();
var pageSizeBits = AofPageSizeBits();View on GitHub (pinned to 951b0fc683)
Solutions
- Set a positive value, e.g. --initial-io-record-size 4k.
- Omit the flag entirely to get the built-in default (UseDefaultInitialIORecordSize).
Example fix
# before (fails) garnet-server --initial-io-record-size 0 # after garnet-server --initial-io-record-size 4k # or omit the flag
Defensive patterns
Strategy: validation
Validate before calling
if (!string.IsNullOrEmpty(options.InitialIORecordSize)
&& ServerOptions.TryParseSize(options.InitialIORecordSize, out var io)
&& io <= 0) {
throw new ArgumentOutOfRangeException("InitialIORecordSize must be positive");
} Prevention
- Never set InitialIORecordSize to 0; omit the flag for the default.
- Audit config templates that default numeric knobs to 0.
When it happens
Trigger: Setting --initial-io-record-size 0. Thrown at GarnetServerOptions.cs:951-952.
Common situations: Using 0 expecting 'disabled/default'; misconfigured templates defaulting numeric knobs to 0.
Related errors
- MutablePercent must be between 10 and 95
- Store Log Memory size or PageCount must be specified
- Index size {IndexMemorySize} should not be less than index m
- Read Cache Log Memory size or PageCount must be specified
- Unable to parse MaxInlineKeySize value '{MaxInlineKeySize}'.
AI-assisted analysis of microsoft/garnet@951b0fc683 (2026-08-13).
Data as JSON: /api/errors/5ba82f2f6f59fd0a.
Report an issue: GitHub.