microsoft/garnet · critical · Exception
Cannot use CommitFrequencyMs or CommitWait without EnableAOF
Error message
Cannot use CommitFrequencyMs or CommitWait without EnableAOF
What it means
Thrown by GarnetServer.CreateAOF when AOF is disabled (EnableAOF=false) but either CommitFrequencyMs is non-zero or WaitForCommit is true. These settings only make sense in the context of an active append-only file; without AOF enabled, they are meaningless and indicate a misconfiguration. Garnet fails fast rather than silently ignoring the intent.
Source
Thrown at libs/host/GarnetServer.cs:480
, Tsavorite.core.StoreFunctions.Create(new GarnetKeyComparer(),
() => new GarnetObjectSerializer(customCommandManager),
new GarnetRecordTriggers(cacheSizeTracker, rangeIndexManager, vectorManager))
, (allocatorSettings, storeFunctions) => new(allocatorSettings, storeFunctions));
if (kvSettings.LogMemorySize > 0 || kvSettings.ReadCacheMemorySize > 0)
{
cacheSizeTracker.Initialize(store, kvSettings.LogMemorySize, kvSettings.ReadCacheMemorySize, this.loggerFactory);
sizeTracker = cacheSizeTracker;
}
return store;
}
private GarnetAppendOnlyFile CreateAOF(int dbId)
{
if (!opts.EnableAOF)
{
if (opts.CommitFrequencyMs != 0 || opts.WaitForCommit)
throw new Exception("Cannot use CommitFrequencyMs or CommitWait without EnableAOF");
return null;
}
if (opts.FastAofTruncate && opts.CommitFrequencyMs != -1)
throw new Exception("Need to set CommitFrequencyMs to -1 (manual commits) with FastAofTruncate");
opts.GetAofSettings(dbId, out var aofSettings);
var appendOnlyFile = new GarnetAppendOnlyFile(opts, aofSettings, logger: this.loggerFactory?.CreateLogger("GarnetLog [aof]"));
if (opts.CommitFrequencyMs < 0 && opts.WaitForCommit)
throw new Exception("Cannot use CommitWait with manual commits");
return appendOnlyFile;
}
/// <summary>
/// Start server instance
/// </summary>
public void Start()View on GitHub (pinned to 951b0fc683)
Solutions
- If you want AOF durability, set EnableAOF=true.
- If AOF is intentionally disabled, set CommitFrequencyMs=0 and WaitForCommit=false.
- Review your config to ensure AOF-related settings are consistent with the EnableAOF flag.
Example fix
// before
var opts = new GarnetServerOptions
{
EnableAOF = false,
CommitFrequencyMs = 1000 // inconsistent
};
// after: enable AOF
var opts = new GarnetServerOptions
{
EnableAOF = true,
CommitFrequencyMs = 1000
}; Defensive patterns
Strategy: validation
Validate before calling
if (!opts.EnableAOF && (opts.CommitFrequencyMs != 0 || opts.WaitForCommit))
throw new InvalidOperationException(
"CommitFrequencyMs and WaitForCommit require EnableAOF=true. " +
"Either enable AOF or clear these settings."); Type guard
static bool AreAofSettingsConsistent(GarnetServerOptions opts) =>
opts.EnableAOF || (opts.CommitFrequencyMs == 0 && !opts.WaitForCommit); Prevention
- Only set CommitFrequencyMs and WaitForCommit when EnableAOF is true.
- Review all AOF-related settings as a group when toggling EnableAOF.
- Use config validation at startup to catch inconsistent settings early.
When it happens
Trigger: Configuring GarnetServerOptions with EnableAOF=false while also setting CommitFrequencyMs to a non-zero value or WaitForCommit=true. The check is at GarnetServer.cs:479.
Common situations: Disabling AOF but forgetting to clear related commit settings; config templates that set commit parameters globally; misunderstanding that commit frequency only applies when AOF is active.
Related errors
- Need to set CommitFrequencyMs to -1 (manual commits) with Fa
- Cannot use CommitWait with manual commits
- AofSizeLimit cannot be enforced with disabled AOF!
- AofMemorySize (effective {effectiveMemory} after rounding do
- AofPageSize (effective {effectivePage} after rounding down t
AI-assisted analysis of microsoft/garnet@951b0fc683 (2026-08-13).
Data as JSON: /api/errors/5dd97c755a97fed0.
Report an issue: GitHub.