microsoft/garnet · error · Exception

Revivification cannot specify both record sizes and in-chain

Error message

Revivification cannot specify both record sizes and in-chain-only.

What it means

Generic Exception thrown during Options.Initialize revivification validation when RevivBinRecordSizes is specified AND RevivInChainOnly is enabled. These two modes are mutually exclusive: explicit bin sizes define a free-list reuse scheme, while in-chain-only restricts revivification to records within the same hash chain. Enabling both is contradictory, so the guard rejects it.

Source

Thrown at libs/host/Configuration/Options.cs:798

            }

            if (!string.IsNullOrEmpty(UnixSocketPath))
                endpoints = [.. endpoints, new UnixDomainSocketEndPoint(UnixSocketPath)];

            // Unix file permission octal to UnixFileMode
            var unixSocketPermissions = (UnixFileMode)Convert.ToInt32(UnixSocketPermission.ToString(), 8);

            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)

View on GitHub (pinned to 951b0fc683)

Solutions

  1. Choose one revivification mode: either use explicit RevivBinRecordSizes (remove RevivInChainOnly), or use RevivInChainOnly (remove RevivBinRecordSizes).
  2. Audit the config for stale revivification settings left over from a previous strategy.

Example fix

// before
options.RevivBinRecordSizes = new[] { 64, 128 };
options.RevivInChainOnly = true;

// after: keep in-chain-only, remove bin sizes
options.RevivInChainOnly = true;
// RevivBinRecordSizes removed
Defensive patterns

Strategy: validation

Validate before calling

void ValidateRevivExclusivity(int[] sizes, bool inChainOnly)
{
    if (sizes != null && sizes.Length > 0 && inChainOnly)
        throw new InvalidOperationException("Cannot specify both RevivBinRecordSizes and RevivInChainOnly. Choose one mode.");
}

Try / catch

try
{
    options.Initialize(logger);
}
catch (Exception ex) when (ex.Message.Contains("in-chain-only"))
{
    logger.LogError("Revivification conflict: remove bin sizes or disable in-chain-only.");
    throw;
}

Prevention

When it happens

Trigger: Setting both --reviv-bin-record-sizes (any values) and --reviv-in-chain-only true in the same configuration. Happens when a user enables in-chain-only mode but forgets to remove previously-defined bin sizes.

Common situations: Migrating revivification strategy from bin-based to in-chain-only without clearing the old bin sizes; config overlay that sets in-chain-only on top of a base config that already defines bins.

Related errors


AI-assisted analysis of microsoft/garnet@951b0fc683 (2026-08-13). Data as JSON: /api/errors/4d3d684dc4ef64cf. Report an issue: GitHub.