microsoft/garnet · error · Exception
MaxInlineValueSize value '{MaxInlineValueSize}' ({sizeInByte
Error message
MaxInlineValueSize value '{MaxInlineValueSize}' ({sizeInBytes} bytes) is outside the allowed range [{MinBytes}, {MaxBytes}] bytes. What it means
After parsing, MaxInlineValueSize must be within [0, 0xFFFFFE] (16,777,214) bytes. The ceiling mirrors Tsavorite's RecordDataHeader value-length inline limit (LogSettings.MaxInlineValueSizeLimit = (1 << kValueLengthBits) - 2). Values above this cannot be represented in the inline record header.
Source
Thrown at libs/server/Servers/GarnetServerOptions.cs:927
/// inline limit; see <c>LogSettings.MaxInlineValueSizeLimit</c> — this value MUST be kept in sync because LogSettings
/// is internal to Tsavorite.core and not visible from Garnet.server). If this value is not specified, it defaults
/// to the minimum of 1m or <paramref name="pageSize"/> / 2; otherwise, the value must be <= pageSize / 2.
/// <returns>The byte-length value used for <c>KVSettings.MaxInlineValueSize</c>.</returns>
/// <exception cref="Exception">Thrown when the value cannot be parsed or is outside the allowed byte range.</exception>
/// </summary>
public int MaxInlineValueSizeBytes(long pageSize)
{
const long MinBytes = 0; // TODO: LogSettings.MinMaxInlineSize
const long MaxBytes = 0xFFFFFE; // TODO: LogSettings.MaxInlineValueSizeLimit (= (1 << kValueLengthBits) - 2)
if (string.IsNullOrEmpty(MaxInlineValueSize))
return (int)Math.Min(pageSize / 2, KVSettings.DefaultMaxInlineValueSize);
if (!TryParseSize(MaxInlineValueSize, out var sizeInBytes))
throw new Exception($"Unable to parse {nameof(MaxInlineValueSize)} value '{MaxInlineValueSize}'. Expected a memory size string (e.g. '4k', '16m').");
if (sizeInBytes < MinBytes || sizeInBytes > MaxBytes)
throw new Exception($"{nameof(MaxInlineValueSize)} value '{MaxInlineValueSize}' ({sizeInBytes} bytes) is outside the allowed range [{MinBytes}, {MaxBytes}] bytes.");
// This check guarantees at least one record fits on a page, because the minimum page size is 4k, and 2k is larger than
// the PageHeader plus non-value components of a record (RecordInfo, RecordDataHeader, Key, and possible Optional fields).
if (sizeInBytes > pageSize / 2)
throw new Exception($"{nameof(MaxInlineValueSize)} value '{MaxInlineValueSize}' ({sizeInBytes} bytes) is greater than half the page size ({pageSize / 2} bytes for PageSize {pageSize} bytes).");
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))View on GitHub (pinned to 951b0fc683)
Solutions
- Keep --max-inline-value-size <= 16777214 bytes (e.g. '15m' is safe).
- Remember an additional check caps it at pageSize/2 (see error 196), so in practice the effective max is half your page size.
- Omit the flag to use the default min(pageSize/2, DefaultMaxInlineValueSize).
Example fix
# before (fails: 32m > ~16MiB) garnet-server --max-inline-value-size 32m # after garnet-server --max-inline-value-size 15m
Defensive patterns
Strategy: validation
Validate before calling
const long MaxInlineValue = 0xFFFFFE;
if (ServerOptions.TryParseSize(options.MaxInlineValueSize, out var v) && (v < 0 || v > MaxInlineValue)) {
throw new ArgumentOutOfRangeException($"MaxInlineValueSize must be in [0, {MaxInlineValue}]");
} Prevention
- Cap inline values at ~16 MiB (and in practice at pageSize/2).
- Leave the default unless you have measured a need.
When it happens
Trigger: Setting --max-inline-value-size above ~16 MiB, e.g. '32m'. Thrown at GarnetServerOptions.cs:926-927.
Common situations: Over-tuning for very large values; assuming the inline limit tracks page or segment size rather than the fixed 24-bit header field.
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
- MaxInlineKeySize value '{MaxInlineKeySize}' ({sizeInBytes} b
AI-assisted analysis of microsoft/garnet@951b0fc683 (2026-08-13).
Data as JSON: /api/errors/36c49b2259eb96d9.
Report an issue: GitHub.