{"record":{"id":"5ba82f2f6f59fd0a","repo":"microsoft/garnet","slug":"initialiorecordsize-value-initialiorecordsize","errorCode":null,"errorMessage":"InitialIORecordSize value '{InitialIORecordSize}' ({sizeInBytes} bytes) must be positive.","messagePattern":"InitialIORecordSize value '(.+?)' \\((.+?) bytes\\) must be positive\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"libs/server/Servers/GarnetServerOptions.cs","lineNumber":952,"sourceCode":"            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\n            if (sizeInBytes <= 0)\n                throw new Exception($\"{nameof(InitialIORecordSize)} value '{InitialIORecordSize}' ({sizeInBytes} bytes) must be positive.\");\n\n            if (sizeInBytes > 1L << PageSizeBits())\n                throw new Exception($\"{nameof(InitialIORecordSize)} value '{InitialIORecordSize}' ({sizeInBytes} bytes) exceeds the page size ({1L << PageSizeBits()} bytes).\");\n\n            return (int)sizeInBytes;\n        }\n\n        /// <summary>\n        /// Get AOF settings\n        /// </summary>\n        /// <param name=\"dbId\">DB ID</param>\n        /// <param name=\"tsavoriteLogSettings\">Tsavorite log settings</param>\n        public void GetAofSettings(int dbId, out TsavoriteLogSettings[] tsavoriteLogSettings)\n        {\n            // Validate sizes up-front (invariant across sublogs) so we don't allocate devices\n            // or commit managers that would need to be disposed if validation fails.\n            var memorySizeBits = AofMemorySizeBits();\n            var pageSizeBits = AofPageSizeBits();","sourceCodeStart":934,"sourceCodeEnd":970,"githubUrl":"https://github.com/microsoft/garnet/blob/951b0fc6838721f89d102c2bbe1b914e8d39d700/libs/server/Servers/GarnetServerOptions.cs#L934-L970","documentation":"After parsing, InitialIORecordSize must be strictly positive. A value of 0 (which parses fine as a bare integer) is meaningless as an initial IO read size, so GetInitialIORecordSizeBytes() rejects it. Note that negative values fail earlier at the parse step (error 197) because TryParseSize rejects the leading minus sign.","triggerScenarios":"Setting --initial-io-record-size 0. Thrown at GarnetServerOptions.cs:951-952.","commonSituations":"Using 0 expecting 'disabled/default'; misconfigured templates defaulting numeric knobs to 0.","solutions":["Set a positive value, e.g. --initial-io-record-size 4k.","Omit the flag entirely to get the built-in default (UseDefaultInitialIORecordSize)."],"exampleFix":"# before (fails)\ngarnet-server --initial-io-record-size 0\n\n# after\ngarnet-server --initial-io-record-size 4k   # or omit the flag","handlingStrategy":"validation","validationCode":"if (!string.IsNullOrEmpty(options.InitialIORecordSize)\n    && ServerOptions.TryParseSize(options.InitialIORecordSize, out var io)\n    && io <= 0) {\n    throw new ArgumentOutOfRangeException(\"InitialIORecordSize must be positive\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never set InitialIORecordSize to 0; omit the flag for the default.","Audit config templates that default numeric knobs to 0."],"tags":["garnet","config","tsavorite","dotnet"],"backgroundTag":null,"analyzedSha":"951b0fc6838721f89d102c2bbe1b914e8d39d700","analyzedAt":"2026-08-13T19:01:32.939Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}