microsoft/garnet · error · Exception
Index size {IndexMemorySize} should not be less than index m
Error message
Index size {IndexMemorySize} should not be less than index max size {IndexMaxMemorySize} What it means
GetSettings enforces that the initial hash index size (IndexMemorySize) is not larger than the maximum growable index size (IndexMaxMemorySize). IndexMaxMemorySize is optional (empty means 'never grow'); if it is set, its cache-line count must be >= the initial index's cache lines, otherwise the max would be below the starting size, which is nonsensical. Both are rounded down to a power of two before comparison.
Source
Thrown at libs/server/Servers/GarnetServerOptions.cs:732
if (kvSettings.PageCount < bufferSize)
{
logger?.LogInformation("[Store] Warning: overriding specified PageCount of {kvSettingsPageCount} with next power of 2 page count {bufferSize}", kvSettings.PageCount, bufferSize);
kvSettings.PageCount = bufferSize;
}
logger?.LogInformation("[Store] There are {LogPages} log pages in memory, all of which will be used because there is no MemorySize limit", PrettySize(bufferSize));
logger?.LogInformation("[Store] No log memory size limit will be enforced");
}
kvSettings.SegmentSize = 1L << SegmentSizeBits(isObj: false);
kvSettings.ObjectLogSegmentSize = 1L << SegmentSizeBits(isObj: true);
logger?.LogInformation("[Store] Using disk segment size of {SegmentSize}", PrettySize(kvSettings.SegmentSize));
logger?.LogInformation("[Store] Using hash index size of {IndexMemorySize} ({indexCacheLines} cache lines)", PrettySize(kvSettings.IndexSize), PrettySize(indexCacheLines));
logger?.LogInformation("[Store] Hash index size is optimized for up to ~{distinctKeys} distinct keys", PrettySize(indexCacheLines * 4L));
AdjustedIndexMaxCacheLines = IndexMaxMemorySize == string.Empty ? 0 : IndexSizeCachelines("hash index max size", IndexMaxMemorySize);
if (AdjustedIndexMaxCacheLines != 0 && AdjustedIndexMaxCacheLines < indexCacheLines)
throw new Exception($"Index size {IndexMemorySize} should not be less than index max size {IndexMaxMemorySize}");
if (AdjustedIndexMaxCacheLines > 0)
{
logger?.LogInformation("[Store] Using hash index max size of {MaxSize}, ({CacheLines} cache lines)", PrettySize(AdjustedIndexMaxCacheLines * 64L), PrettySize(AdjustedIndexMaxCacheLines));
logger?.LogInformation("[Store] Hash index max size is optimized for up to ~{distinctKeys} distinct keys", PrettySize(AdjustedIndexMaxCacheLines * 4L));
}
logger?.LogInformation("[Store] Using log mutable percentage of {MutablePercent}%", MutablePercent);
if (DeviceType == DeviceType.Default)
DeviceType = Devices.GetDefaultDeviceType();
DeviceFactoryCreator ??= new LocalStorageNamedDeviceFactoryCreator(
deviceType: DeviceType,
ioBackend: DeviceIoBackend,
numCompletionThreads: DeviceCompletionThreads,
throttleLimit: DeviceThrottleLimit > 0 ? DeviceThrottleLimit : null,
logger: logger);
if (DeviceType == DeviceType.Native && OperatingSystem.IsLinux())
logger?.LogInformation("Using device type {deviceType} (io-backend={ioBackend}, completion-threads={ct}, throttle-limit={tl})", DeviceType, DeviceIoBackend, DeviceCompletionThreads, DeviceThrottleLimit > 0 ? DeviceThrottleLimit.ToString() : "device-default");View on GitHub (pinned to 951b0fc683)
Solutions
- Make --index-max-size >= --index (e.g. --index 128m --index-max-size 256m).
- Omit --index-max-size entirely if you do not want the index to grow (empty = fixed initial size).
- Double-check that both values are power-of-two friendly, since they are rounded down before comparison.
Example fix
# before (fails: initial > max) garnet-server --index 256m --index-max-size 128m # after garnet-server --index 128m --index-max-size 256m
Defensive patterns
Strategy: validation
Validate before calling
// If a max index size is configured, it must be >= the initial size
if (!string.IsNullOrEmpty(options.IndexMaxMemorySize)) {
var init = PreviousPowerOf2(ParseSize(options.IndexMemorySize, out _));
var max = PreviousPowerOf2(ParseSize(options.IndexMaxMemorySize, out _));
if (max < init) throw new InvalidOperationException("IndexMaxMemorySize must be >= IndexMemorySize");
} Prevention
- Only set --index-max-size when you want growth, and keep it >= --index.
- Remember both values round down to a power of two before comparison.
When it happens
Trigger: Setting --index/-i (IndexMemorySize) larger than --index-max-size (IndexMaxMemorySize), e.g. --index 256m --index-max-size 128m. Thrown at GarnetServerOptions.cs:731-732.
Common situations: Copy-paste config errors; intending to set a 'max' that is actually smaller than the start; misunderstanding that IndexMaxMemorySize is a growth ceiling, not the initial allocation.
Related errors
- MutablePercent must be between 10 and 95
- Store Log Memory size or PageCount must be specified
- Read Cache Log Memory size or PageCount must be specified
- MaxInlineKeySize value '{MaxInlineKeySize}' ({sizeInBytes} b
- MaxInlineValueSize value '{MaxInlineValueSize}' ({sizeInByte
AI-assisted analysis of microsoft/garnet@951b0fc683 (2026-08-13).
Data as JSON: /api/errors/cbdc7b934e8e230c.
Report an issue: GitHub.