microsoft/garnet · error · Exception

Unable to parse InitialIORecordSize value '{InitialIORecordS

Error message

Unable to parse InitialIORecordSize value '{InitialIORecordSize}'. Expected a memory size string (e.g. '4k', '8k').

What it means

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).

Source

Thrown at libs/server/Servers/GarnetServerOptions.cs:949

            if (sizeInBytes > pageSize / 2)
                throw new Exception($"{nameof(MaxInlineValueSize)} value '{MaxInlineValueSize}' ({sizeInBytes} bytes) is greater than half the page size ({pageSize / 2} bytes for PageSize {pageSize} bytes).");

            return (int)sizeInBytes;
        }

        /// <summary>
        /// Parse <see cref="InitialIORecordSize"/> as a byte count.
        /// Returns <see cref="KVSettings.UseDefaultInitialIORecordSize"/> if the value is null or empty (use default).
        /// </summary>
        /// <returns>The byte value used for <c>KVSettings.InitialIORecordSize</c>, or <see cref="KVSettings.UseDefaultInitialIORecordSize"/> if unset.</returns>
        /// <exception cref="Exception">Thrown when the value cannot be parsed.</exception>
        public int GetInitialIORecordSizeBytes()
        {
            if (string.IsNullOrEmpty(InitialIORecordSize))
                return KVSettings.UseDefaultInitialIORecordSize;

            if (!TryParseSize(InitialIORecordSize, out var sizeInBytes))
                throw new Exception($"Unable to parse {nameof(InitialIORecordSize)} value '{InitialIORecordSize}'. Expected a memory size string (e.g. '4k', '8k').");

            if (sizeInBytes <= 0)
                throw new Exception($"{nameof(InitialIORecordSize)} value '{InitialIORecordSize}' ({sizeInBytes} bytes) must be positive.");

            if (sizeInBytes > 1L << PageSizeBits())
                throw new Exception($"{nameof(InitialIORecordSize)} value '{InitialIORecordSize}' ({sizeInBytes} bytes) exceeds the page size ({1L << PageSizeBits()} bytes).");

            return (int)sizeInBytes;
        }

        /// <summary>
        /// Get AOF settings
        /// </summary>
        /// <param name="dbId">DB ID</param>
        /// <param name="tsavoriteLogSettings">Tsavorite log settings</param>
        public void GetAofSettings(int dbId, out TsavoriteLogSettings[] tsavoriteLogSettings)
        {
            // Validate sizes up-front (invariant across sublogs) so we don't allocate devices

View on GitHub (pinned to 951b0fc683)

Solutions

  1. Use accepted forms: '4k', '8k', '128', etc.
  2. Drop spaces and avoid units outside k/m/g/t/p.
  3. Omit the flag to use the built-in default.

Example fix

# before (fails)
garnet-server --initial-io-record-size '4 KB'

# after
garnet-server --initial-io-record-size 4k
Defensive patterns

Strategy: validation

Validate before calling

static bool IsValidSizeString(string s) => string.IsNullOrEmpty(s) || ServerOptions.TryParseSize(s, out _);
if (!IsValidSizeString(options.InitialIORecordSize)) {
    throw new ArgumentException("InitialIORecordSize must be like '4k' or '8k'");
}

Prevention

When it happens

Trigger: 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.

Common situations: Including a space ('4 KB'); using hex; typos; unrecognized unit spellings.

Understand the failure class

Related errors


AI-assisted analysis of microsoft/garnet@951b0fc683 (2026-08-13). Data as JSON: /api/errors/4fae3d412e3e7ab7. Report an issue: GitHub.