microsoft/garnet · error · Exception
Revivification bin counts require bin sizes.
Error message
Revivification bin counts require bin sizes.
What it means
Generic Exception thrown during Options.Initialize revivification validation when RevivBinRecordCounts is specified without corresponding RevivBinRecordSizes. Counts are meaningless without sizes because they define how many entries each sized bin holds. The guard requires sizes to be present whenever counts are.
Source
Thrown at libs/host/Configuration/Options.cs:806
var revivBinRecordSizes = this.RevivBinRecordSizes?.ToArray();
var revivBinRecordCounts = this.RevivBinRecordCounts?.ToArray();
bool hasRecordSizes = revivBinRecordSizes?.Length > 0, hasRecordCounts = revivBinRecordCounts?.Length > 0;
bool useRevivBinsPowerOf2 = enableRevivification; // may be overridden
if (hasRecordSizes)
{
if (hasRecordCounts && revivBinRecordCounts.Length > 1 && revivBinRecordCounts.Length != revivBinRecordSizes.Length)
throw new Exception("Incompatible revivification record size and count cardinality.");
if (RevivInChainOnly.GetValueOrDefault())
throw new Exception("Revivification cannot specify both record sizes and in-chain-only.");
useRevivBinsPowerOf2 = false;
}
if (hasRecordCounts)
{
if (useRevivBinsPowerOf2)
throw new Exception("Revivification cannot specify both record counts and powerof2 bins.");
if (!hasRecordSizes)
throw new Exception("Revivification bin counts require bin sizes.");
useRevivBinsPowerOf2 = false;
}
if (RevivBinBestFitScanLimit != 0)
{
if (!hasRecordSizes && !enableRevivification)
throw new Exception("Revivification cannot specify best fit scan limit without specifying bins.");
if (RevivBinBestFitScanLimit < 0)
throw new Exception("RevivBinBestFitScanLimit must be >= 0.");
}
if (RevivifiableFraction != RevivificationSettings.DefaultRevivifiableFraction)
{
if (!hasRecordSizes && !enableRevivification)
throw new Exception("Revivification cannot specify RevivifiableFraction without specifying bins.");
}
// Warn users who explicitly opt into Scan compaction about the memory-spike cost.
// Scan builds a temporary parallel KV index proportional to the keyspace; Lookup is the recommended alternative.
if (CompactionType == LogCompactionType.Scan)View on GitHub (pinned to 951b0fc683)
Solutions
- Provide RevivBinRecordSizes with at least as many entries as the counts array.
- If you do not need custom bin sizing, remove RevivBinRecordCounts and rely on the default power-of-2 scheme.
Example fix
// before
options.RevivBinRecordCounts = new[] { 100, 200 };
// no sizes
// after
options.RevivBinRecordSizes = new[] { 64, 128 };
options.RevivBinRecordCounts = new[] { 100, 200 }; Defensive patterns
Strategy: validation
Validate before calling
void ValidateRevivCountsHaveSizes(int[] sizes, int[] counts)
{
if (counts != null && counts.Length > 0 && (sizes == null || sizes.Length == 0))
throw new InvalidOperationException("RevivBinRecordCounts requires RevivBinRecordSizes to be specified.");
} Try / catch
try
{
options.Initialize(logger);
}
catch (Exception ex) when (ex.Message.Contains("bin counts require bin sizes"))
{
logger.LogError("Revivification error: provide RevivBinRecordSizes when specifying counts.");
throw;
} Prevention
- Always specify sizes first, then counts, when configuring custom reviv bins.
- Treat sizes and counts as a single coupled configuration unit.
When it happens
Trigger: Setting RevivBinRecordCounts to any value while RevivBinRecordSizes is null/empty. Happens when a user configures how many free entries per bin but forgets to define what the bin sizes are.
Common situations: Partial config edit where counts were added but sizes were not; misunderstanding the parallel-array requirement of the revivification bin scheme.
Related errors
- Incompatible revivification record size and count cardinalit
- Revivification cannot specify both record sizes and in-chain
- Revivification cannot specify both record counts and powerof
- Revivification cannot specify best fit scan limit without sp
- RevivBinBestFitScanLimit must be >= 0.
AI-assisted analysis of microsoft/garnet@951b0fc683 (2026-08-13).
Data as JSON: /api/errors/d63c308e282ab027.
Report an issue: GitHub.