{"record":{"id":"4fae3d412e3e7ab7","repo":"microsoft/garnet","slug":"unable-to-parse-initialiorecordsize-value-initia","errorCode":null,"errorMessage":"Unable to parse InitialIORecordSize value '{InitialIORecordSize}'. Expected a memory size string (e.g. '4k', '8k').","messagePattern":"Unable to parse InitialIORecordSize value '(.+?)'\\. Expected a memory size string \\(e\\.g\\. '4k', '8k'\\)\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"libs/server/Servers/GarnetServerOptions.cs","lineNumber":949,"sourceCode":"            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\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","sourceCodeStart":931,"sourceCodeEnd":967,"githubUrl":"https://github.com/microsoft/garnet/blob/951b0fc6838721f89d102c2bbe1b914e8d39d700/libs/server/Servers/GarnetServerOptions.cs#L931-L967","documentation":"GetInitialIORecordSizeBytes() parses the InitialIORecordSize option with TryParseSize (bare integer or integer + k/m/g/t/p suffix). The value controls the initial read size used when fetching records from disk; an unparseable string is rejected at startup. null/empty is valid and means 'use the default' (UseDefaultInitialIORecordSize).","triggerScenarios":"Setting --initial-io-record-size to a non-conforming string such as '4 KB', '0x10', '1.5k', or 'abc'. Thrown at GarnetServerOptions.cs:948-949.","commonSituations":"Including a space ('4 KB'); using hex; typos; unrecognized unit spellings.","solutions":["Use accepted forms: '4k', '8k', '128', etc.","Drop spaces and avoid units outside k/m/g/t/p.","Omit the flag to use the built-in default."],"exampleFix":"# before (fails)\ngarnet-server --initial-io-record-size '4 KB'\n\n# after\ngarnet-server --initial-io-record-size 4k","handlingStrategy":"validation","validationCode":"static bool IsValidSizeString(string s) => string.IsNullOrEmpty(s) || ServerOptions.TryParseSize(s, out _);\nif (!IsValidSizeString(options.InitialIORecordSize)) {\n    throw new ArgumentException(\"InitialIORecordSize must be like '4k' or '8k'\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use accepted size forms (e.g. '4k'); avoid spaces and hex.","Reuse a shared size-string validator for all such options."],"tags":["garnet","config","tsavorite","parsing","dotnet"],"backgroundTag":null,"analyzedSha":"951b0fc6838721f89d102c2bbe1b914e8d39d700","analyzedAt":"2026-08-13T19:01:32.939Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}