{"record":{"id":"8cc97b25a0a4a834","repo":"microsoft/garnet","slug":"invalid-name","errorCode":null,"errorMessage":"Invalid {name}","messagePattern":"Invalid (.+?)","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"libs/server/Servers/ServerOptions.cs","lineNumber":208,"sourceCode":"        /// <returns></returns>\n        public int SegmentSizeBits(bool isObj)\n        {\n            long size = ParseSize(isObj ? ObjectLogSegmentSize : SegmentSize, out _);\n            long adjustedSize = PreviousPowerOf2(size);\n            if (size != adjustedSize)\n                logger?.LogInformation(\"Warning: using lower {SegmentType} than specified (power of 2)\", isObj ? \"ObjSegmentSize\" : \"SegmentSize\");\n            return (int)Math.Log(adjustedSize, 2);\n        }\n\n        /// <summary>\n        /// Get index size\n        /// </summary>\n        /// <returns></returns>\n        public int IndexSizeCachelines(string name, string indexSize)\n        {\n            long size = ParseSize(indexSize, out _);\n            long adjustedSize = PreviousPowerOf2(size);\n            if (adjustedSize < 64 || adjustedSize > (1L << 37)) throw new Exception($\"Invalid {name}\");\n            if (size != adjustedSize)\n                logger?.LogInformation(\"Warning: using lower {name} than specified (power of 2)\", name);\n            return (int)(adjustedSize / 64);\n        }\n\n        /// <summary>\n        /// Parse size from string specification\n        /// </summary>\n        /// <param name=\"value\"></param>\n        /// <param name=\"bytesRead\"></param>\n        /// <returns></returns>\n        public static long ParseSize(string value, out int bytesRead)\n        {\n            ReadOnlySpan<char> suffix = ['k', 'm', 'g', 't', 'p'];\n            long result = 0;\n            bytesRead = 0;\n            for (var i = 0; i < value.Length; i++)\n            {","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/microsoft/garnet/blob/951b0fc6838721f89d102c2bbe1b914e8d39d700/libs/server/Servers/ServerOptions.cs#L190-L226","documentation":"Garnet validates that the index size (hash index) is between 64 bytes and 2^37 bytes (137 GB) after rounding to the nearest power of two. Values outside this range are rejected with a generic 'Invalid {name}' message. This applies to IndexSizeCachelines() which converts the size to cacheline (64-byte) units.","triggerScenarios":"Calling IndexSizeCachelines() with a value that rounds to less than 64 bytes or more than 2^37 bytes. For example, --index-size 32 or --index-size 200000000000 (200PB).","commonSituations":"Typo in index-size config (too many or too few zeros); misunderstanding units (entering 1 meaning 1 byte instead of 1MB); copy-paste from a config using different unit conventions.","solutions":["Set --index-size to a power-of-two value between 64 and 137438953472 (e.g., --index-size 16m for a typical deployment).","Remove the index-size override to use Garnet's default.","Double-check the value and unit suffix (k, m, g) if using size notation."],"exampleFix":"// before\n--index-size 32\n\n// after\n--index-size 64","handlingStrategy":"validation","validationCode":"var size = ServerOptions.ParseSize(options.IndexSize, out _);\nvar rounded = PreviousPowerOf2(size);\nif (rounded < 64 || rounded > (1L << 37))\n    throw new InvalidOperationException($\"Index size {options.IndexSize} is out of range [64, {1L << 37}].\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use a reasonable index size like 16m or 64m for typical deployments.","Double-check exponent and unit suffix on index-size values.","Validate index size in config before deployment."],"tags":["configuration","index-size","startup","garnet"],"backgroundTag":null,"analyzedSha":"951b0fc6838721f89d102c2bbe1b914e8d39d700","analyzedAt":"2026-08-13T19:01:32.939Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}