{"record":{"id":"6d12e4532db56be3","repo":"microsoft/garnet","slug":"maxinlinevaluesize-value-maxinlinevaluesize-6d12e4","errorCode":null,"errorMessage":"MaxInlineValueSize value '{MaxInlineValueSize}' ({sizeInBytes} bytes) is greater than half the page size ({pageSize / 2} bytes for PageSize {pageSize} bytes).","messagePattern":"MaxInlineValueSize value '(.+?)' \\((.+?) bytes\\) is greater than half the page size \\((.+?) bytes for PageSize (.+?) bytes\\)\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"libs/server/Servers/GarnetServerOptions.cs","lineNumber":932,"sourceCode":"        /// </summary>\n        public int MaxInlineValueSizeBytes(long pageSize)\n        {\n            const long MinBytes = 0;                    // TODO: LogSettings.MinMaxInlineSize\n            const long MaxBytes = 0xFFFFFE;             // TODO: LogSettings.MaxInlineValueSizeLimit (= (1 << kValueLengthBits) - 2)\n\n            if (string.IsNullOrEmpty(MaxInlineValueSize))\n                return (int)Math.Min(pageSize / 2, KVSettings.DefaultMaxInlineValueSize);\n\n            if (!TryParseSize(MaxInlineValueSize, out var sizeInBytes))\n                throw new Exception($\"Unable to parse {nameof(MaxInlineValueSize)} value '{MaxInlineValueSize}'. Expected a memory size string (e.g. '4k', '16m').\");\n\n            if (sizeInBytes < MinBytes || sizeInBytes > MaxBytes)\n                throw new Exception($\"{nameof(MaxInlineValueSize)} value '{MaxInlineValueSize}' ({sizeInBytes} bytes) is outside the allowed range [{MinBytes}, {MaxBytes}] bytes.\");\n\n            // This check guarantees at least one record fits on a page, because the minimum page size is 4k, and 2k is larger than\n            // the PageHeader plus non-value components of a record (RecordInfo, RecordDataHeader, Key, and possible Optional fields).\n            if (sizeInBytes > pageSize / 2)\n                throw new Exception($\"{nameof(MaxInlineValueSize)} value '{MaxInlineValueSize}' ({sizeInBytes} bytes) is greater than half the page size ({pageSize / 2} bytes for PageSize {pageSize} bytes).\");\n\n            return (int)sizeInBytes;\n        }\n\n        /// <summary>\n        /// Parse <see cref=\"InitialIORecordSize\"/> as a byte count.\n        /// Returns <see cref=\"KVSettings.UseDefaultInitialIORecordSize\"/> if the value is null or empty (use default).\n        /// </summary>\n        /// <returns>The byte value used for <c>KVSettings.InitialIORecordSize</c>, or <see cref=\"KVSettings.UseDefaultInitialIORecordSize\"/> if unset.</returns>\n        /// <exception cref=\"Exception\">Thrown when the value cannot be parsed.</exception>\n        public int GetInitialIORecordSizeBytes()\n        {\n            if (string.IsNullOrEmpty(InitialIORecordSize))\n                return KVSettings.UseDefaultInitialIORecordSize;\n\n            if (!TryParseSize(InitialIORecordSize, out var sizeInBytes))\n                throw new Exception($\"Unable to parse {nameof(InitialIORecordSize)} value '{InitialIORecordSize}'. Expected a memory size string (e.g. '4k', '8k').\");\n","sourceCodeStart":914,"sourceCodeEnd":950,"githubUrl":"https://github.com/microsoft/garnet/blob/951b0fc6838721f89d102c2bbe1b914e8d39d700/libs/server/Servers/GarnetServerOptions.cs#L914-L950","documentation":"Even when within [0, 0xFFFFFE], MaxInlineValueSize must not exceed half the page size so that at least one record (header + key + value) is guaranteed to fit on a single page. With the default 4 KiB page this caps inline values at 2 KiB; raising the value without also raising --page triggers the error.","triggerScenarios":"Setting --max-inline-value-size larger than pageSize/2, e.g. '3m' with the default ~4m page (3m > 2m). Thrown at GarnetServerOptions.cs:931-932.","commonSituations":"Increasing inline value size to hold bigger payloads without proportionally increasing the page size; assuming the header-field limit (16MiB) is the only constraint.","solutions":["Lower --max-inline-value-size to at most half the page size.","Or raise the page size proportionally, e.g. --page 16m to allow --max-inline-value-size 8m.","Omit the flag to use the safe default of min(pageSize/2, DefaultMaxInlineValueSize)."],"exampleFix":"# before (fails: 3m > 4m/2 with default page)\ngarnet-server --max-inline-value-size 3m\n\n# after: raise the page size to match\ngarnet-server --page 8m --max-inline-value-size 3m","handlingStrategy":"validation","validationCode":"var pageSize = 1L << options.PageSizeBits();\nif (ServerOptions.TryParseSize(options.MaxInlineValueSize, out var v) && v > pageSize / 2) {\n    throw new ArgumentOutOfRangeException($\"MaxInlineValueSize ({v}) must be <= pageSize/2 ({pageSize / 2})\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep MaxInlineValueSize <= pageSize/2; raise --page if you need bigger inline values.","Validate the value against the configured page size, not just the header limit."],"tags":["garnet","config","tsavorite","storage","dotnet"],"backgroundTag":null,"analyzedSha":"951b0fc6838721f89d102c2bbe1b914e8d39d700","analyzedAt":"2026-08-13T19:01:32.939Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}