{"record":{"id":"4d3d684dc4ef64cf","repo":"microsoft/garnet","slug":"revivification-cannot-specify-both-record-sizes-an","errorCode":null,"errorMessage":"Revivification cannot specify both record sizes and in-chain-only.","messagePattern":"Revivification cannot specify both record sizes and in-chain-only\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"libs/host/Configuration/Options.cs","lineNumber":798,"sourceCode":"            }\n\n            if (!string.IsNullOrEmpty(UnixSocketPath))\n                endpoints = [.. endpoints, new UnixDomainSocketEndPoint(UnixSocketPath)];\n\n            // Unix file permission octal to UnixFileMode\n            var unixSocketPermissions = (UnixFileMode)Convert.ToInt32(UnixSocketPermission.ToString(), 8);\n\n            var revivBinRecordSizes = this.RevivBinRecordSizes?.ToArray();\n            var revivBinRecordCounts = this.RevivBinRecordCounts?.ToArray();\n            bool hasRecordSizes = revivBinRecordSizes?.Length > 0, hasRecordCounts = revivBinRecordCounts?.Length > 0;\n            bool useRevivBinsPowerOf2 = enableRevivification; // may be overridden\n\n            if (hasRecordSizes)\n            {\n                if (hasRecordCounts && revivBinRecordCounts.Length > 1 && revivBinRecordCounts.Length != revivBinRecordSizes.Length)\n                    throw new Exception(\"Incompatible revivification record size and count cardinality.\");\n                if (RevivInChainOnly.GetValueOrDefault())\n                    throw new Exception(\"Revivification cannot specify both record sizes and in-chain-only.\");\n                useRevivBinsPowerOf2 = false;\n            }\n            if (hasRecordCounts)\n            {\n                if (useRevivBinsPowerOf2)\n                    throw new Exception(\"Revivification cannot specify both record counts and powerof2 bins.\");\n                if (!hasRecordSizes)\n                    throw new Exception(\"Revivification bin counts require bin sizes.\");\n                useRevivBinsPowerOf2 = false;\n            }\n            if (RevivBinBestFitScanLimit != 0)\n            {\n                if (!hasRecordSizes && !enableRevivification)\n                    throw new Exception(\"Revivification cannot specify best fit scan limit without specifying bins.\");\n                if (RevivBinBestFitScanLimit < 0)\n                    throw new Exception(\"RevivBinBestFitScanLimit must be >= 0.\");\n            }\n            if (RevivifiableFraction != RevivificationSettings.DefaultRevivifiableFraction)","sourceCodeStart":780,"sourceCodeEnd":816,"githubUrl":"https://github.com/microsoft/garnet/blob/951b0fc6838721f89d102c2bbe1b914e8d39d700/libs/host/Configuration/Options.cs#L780-L816","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Choose one revivification mode: either use explicit RevivBinRecordSizes (remove RevivInChainOnly), or use RevivInChainOnly (remove RevivBinRecordSizes).","Audit the config for stale revivification settings left over from a previous strategy."],"exampleFix":"// before\noptions.RevivBinRecordSizes = new[] { 64, 128 };\noptions.RevivInChainOnly = true;\n\n// after: keep in-chain-only, remove bin sizes\noptions.RevivInChainOnly = true;\n// RevivBinRecordSizes removed","handlingStrategy":"validation","validationCode":"void ValidateRevivExclusivity(int[] sizes, bool inChainOnly)\n{\n    if (sizes != null && sizes.Length > 0 && inChainOnly)\n        throw new InvalidOperationException(\"Cannot specify both RevivBinRecordSizes and RevivInChainOnly. Choose one mode.\");\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    options.Initialize(logger);\n}\ncatch (Exception ex) when (ex.Message.Contains(\"in-chain-only\"))\n{\n    logger.LogError(\"Revivification conflict: remove bin sizes or disable in-chain-only.\");\n    throw;\n}","preventionTips":["Document which revivification strategy a deployment uses and strip the other's settings.","Use a single config profile per strategy to avoid mixing modes."],"tags":["config","revivification","validation","mutual-exclusion","options"],"backgroundTag":null,"analyzedSha":"951b0fc6838721f89d102c2bbe1b914e8d39d700","analyzedAt":"2026-08-13T19:01:32.939Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}