microsoft/garnet · error · Exception
Revivification cannot specify best fit scan limit without sp
Error message
Revivification cannot specify best fit scan limit without specifying bins.
What it means
Generic Exception thrown during Options.Initialize revivification validation when RevivBinBestFitScanLimit is non-zero but no bins are defined (RevivBinRecordSizes is empty AND EnableRevivification is false). The best-fit scan limit controls how many bins are scanned during best-fit revivification, so it only makes sense when a bin scheme exists.
Source
Thrown at libs/host/Configuration/Options.cs:812
{
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)
{
logger?.LogWarning("Compaction type Scan builds a temporary parallel KV index proportional to the keyspace, causing significant transient memory use. Use Lookup instead unless you have a specific reason for Scan.");
}
if (SlowLogThreshold > 0)
{View on GitHub (pinned to 951b0fc683)
Solutions
- If revivification is disabled, set RevivBinBestFitScanLimit back to 0 (the default).
- If you want the best-fit scan limit, enable revivification (EnableRevivification=true) or provide explicit RevivBinRecordSizes.
Example fix
// before options.EnableRevivification = false; options.RevivBinBestFitScanLimit = 8; // after options.EnableRevivification = false; options.RevivBinBestFitScanLimit = 0;
Defensive patterns
Strategy: validation
Validate before calling
void ValidateScanLimitHasBins(int scanLimit, int[] sizes, bool enableReviv)
{
if (scanLimit != 0 && (sizes == null || sizes.Length == 0) && !enableReviv)
throw new InvalidOperationException("RevivBinBestFitScanLimit requires a bin scheme (sizes or EnableRevivification).");
} Try / catch
try
{
options.Initialize(logger);
}
catch (Exception ex) when (ex.Message.Contains("best fit scan limit without"))
{
logger.LogError("Revivification: scan limit set but no bins configured. Enable revivification or remove the limit.");
throw;
} Prevention
- When disabling revivification, reset all related fields (scan limit, fraction, bins) to defaults.
- Use a config reset helper that clears the entire revivification block at once.
When it happens
Trigger: Setting RevivBinBestFitScanLimit to a non-zero value while neither explicit bin sizes nor EnableRevivification (power-of-2 bins) are configured. Happens when a config carries a stale scan-limit value after revivification was disabled.
Common situations: Disabling revivification (EnableRevivification=false) but leaving RevivBinBestFitScanLimit set in the config; partial config cleanup.
Related errors
- Revivification cannot specify RevivifiableFraction without s
- 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 bin counts require bin sizes.
AI-assisted analysis of microsoft/garnet@951b0fc683 (2026-08-13).
Data as JSON: /api/errors/b4316d6de4b4007c.
Report an issue: GitHub.