{"record":{"id":"7900aef9eedf0c5c","repo":"microsoft/garnet","slug":"propname-value-effective-adjustedsize-byt","errorCode":null,"errorMessage":"{propName} '{value}' (effective {adjustedSize} bytes after rounding to previous power of 2) must be at least {MinPageSizeBytes} bytes to ensure a worst-case record fits within a single page.","messagePattern":"(.+?) '(.+?)' \\(effective (.+?) bytes after rounding to previous power of 2\\) must be at least (.+?) bytes to ensure a worst-case record fits within a single page\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"libs/server/Servers/ServerOptions.cs","lineNumber":164,"sourceCode":"        /// Minimum main-log / read-cache page size in bytes. A worst-case inline record at default Garnet settings\n        /// (MaxInlineKeySize = 128B Tsavorite default, single-byte namespace, all optional fields, max length-byte\n        /// encoding, max filler) plus the 64-byte page header is ~490 bytes when the value-overflow threshold is\n        /// at its largest allowed value relative to PageSize (effective value &lt; effective page); 512 bytes is the\n        /// smallest power-of-2 page size that accommodates this and prevents Tsavorite's \"Entry does not fit on page\".\n        /// </summary>\n        public const long MinPageSizeBytes = 512L;\n\n        /// <summary>\n        /// Validate and convert a page-size configuration value to bits, enforcing <see cref=\"MinPageSizeBytes\"/>.\n        /// </summary>\n        protected int ValidatedPageSizeBits(string value, string propName)\n        {\n            var size = ParseSize(value, out _);\n            var adjustedSize = PreviousPowerOf2(size);\n            if (size != adjustedSize)\n                logger?.LogInformation(\"Warning: using lower {PropName} than specified (power of 2)\", propName);\n            if (adjustedSize < MinPageSizeBytes)\n                throw new Exception($\"{propName} '{value}' (effective {adjustedSize} bytes after rounding to previous power of 2) must be at least {MinPageSizeBytes} bytes to ensure a worst-case record fits within a single page.\");\n            return (int)Math.Log(adjustedSize, 2);\n        }\n\n        /// <summary>\n        /// Get page size\n        /// </summary>\n        /// <returns></returns>\n        public int PageSizeBits() => ValidatedPageSizeBits(PageSize, nameof(PageSize));\n\n        /// <summary>\n        /// Get pub/sub page size\n        /// </summary>\n        /// <returns></returns>\n        public long PubSubPageSizeBytes()\n        {\n            long size = ParseSize(PubSubPageSize, out _);\n            long adjustedSize = PreviousPowerOf2(size);\n            if (size != adjustedSize)","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/microsoft/garnet/blob/951b0fc6838721f89d102c2bbe1b914e8d39d700/libs/server/Servers/ServerOptions.cs#L146-L182","documentation":"Garnet enforces a minimum page size of 512 bytes (MinPageSizeBytes) to ensure a worst-case record fits within a single page. ValidatedPageSizeBits() rounds the configured size down to the nearest power of two and rejects anything below 512. This applies to main log page size, object store page size, and any configuration that delegates to ValidatedPageSizeBits().","triggerScenarios":"Calling ValidatedPageSizeBits() (via PageSizeBits(), ObjPageSizeBits(), etc.) with a value that rounds down below 512 bytes. For example, --page 256 or --page 500 (rounds to 256).","commonSituations":"Setting --page to a very small value to reduce memory; misconfiguring size units (e.g., writing --page 1 thinking it means 1KB instead of 1 byte); using a config template with an old or incorrect page size.","solutions":["Set the page size to at least 512 bytes (e.g., --page 512 or higher, or use suffixes like --page 1k).","Remove the page size override entirely to use Garnet's default (typically 32m).","If specifying a value between 256 and 511, round up to 512 explicitly."],"exampleFix":"// before\n--page 256\n\n// after\n--page 512","handlingStrategy":"validation","validationCode":"const long MinPage = 512;\nvar size = ServerOptions.ParseSize(options.PageSize, out _);\nvar rounded = PreviousPowerOf2(size);\nif (rounded < MinPage)\n    throw new InvalidOperationException($\"Page size {options.PageSize} rounds to {rounded} bytes, minimum is {MinPage}.\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never set page size below 512 bytes.","Use human-readable suffixes (--page 32m) to avoid unit confusion.","Validate all page-size configs in a startup health check script."],"tags":["configuration","page-size","startup","garnet"],"backgroundTag":null,"analyzedSha":"951b0fc6838721f89d102c2bbe1b914e8d39d700","analyzedAt":"2026-08-13T19:01:32.939Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}