microsoft/garnet · error · Exception

MutablePercent must be between 10 and 95

Error message

MutablePercent must be between 10 and 95

What it means

GetSettings rejects a MutablePercent outside [10, 95]. MutablePercent is the fraction of the hybrid log kept mutable (writable) and is passed straight to Tsavorite as MutableFraction; too little mutable space stalls writes and too much defeats the log's immutable-region design. The guard runs before any store allocation, so this fails fast at startup.

Source

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

        /// </summary>
        /// <param name="loggerFactory"></param>
        public void Initialize(ILoggerFactory loggerFactory = null)
        {
        }

        /// <summary>
        /// Get main store settings
        /// </summary>
        /// <param name="loggerFactory">Logger factory for debugging and error tracing</param>
        /// <param name="epoch">Epoch instance used by server</param>
        /// <param name="stateMachineDriver">Common state machine driver used by Garnet</param>
        /// <param name="logFactory">Tsavorite Log factory instance</param>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        public KVSettings GetSettings(ILoggerFactory loggerFactory, LightEpoch epoch, StateMachineDriver stateMachineDriver, out INamedDeviceFactory logFactory)
        {
            if (MutablePercent is < 10 or > 95)
                throw new Exception("MutablePercent must be between 10 and 95");

            var indexCacheLines = IndexSizeCachelines("hash index size", IndexMemorySize);

            var pageSize = 1L << PageSizeBits();
            KVSettings kvSettings = new()
            {
                IndexSize = indexCacheLines * 64L,
                PreallocateLog = false,
                MutableFraction = MutablePercent / 100.0,
                PageSize = pageSize,
                Epoch = epoch,
                StateMachineDriver = stateMachineDriver,
                MaxInlineKeySize = MaxInlineKeySizeBytes(),
                MaxInlineValueSize = MaxInlineValueSizeBytes(pageSize),
                InitialIORecordSize = GetInitialIORecordSizeBytes(),
                loggerFactory = loggerFactory,
                logger = loggerFactory?.CreateLogger("TsavoriteKV [main]")
            };

View on GitHub (pinned to 951b0fc683)

Solutions

  1. Keep --mutable-percent within [10, 95]; the default is 90.
  2. If you intended extreme write headroom, 95 is the allowed maximum — use that instead of 99.
  3. Validate the value in your config pipeline/deployment template before shipping.

Example fix

# before
garnet-server --mutable-percent 5

# after
garnet-server --mutable-percent 10   # or omit to use the default 90
Defensive patterns

Strategy: validation

Validate before calling

if (options.MutablePercent is < 10 or > 95) {
    throw new ArgumentOutOfRangeException(nameof(options.MutablePercent), "Must be between 10 and 95");
}

Prevention

When it happens

Trigger: Setting --mutable-percent to a value below 10 or above 95 (e.g. --mutable-percent 5 or --mutable-percent 99). Evaluated at GarnetServerOptions.cs:669-670 inside GetSettings.

Common situations: Mistuned config copied from guidance for a different engine; attempting to maximize write headroom (99%) or maximize immutable region (5%); typos in JSON/YAML config files.

Related errors


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