{"record":{"id":"5dd97c755a97fed0","repo":"microsoft/garnet","slug":"cannot-use-commitfrequencyms-or-commitwait-without","errorCode":null,"errorMessage":"Cannot use CommitFrequencyMs or CommitWait without EnableAOF","messagePattern":"Cannot use CommitFrequencyMs or CommitWait without EnableAOF","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"critical","filePath":"libs/host/GarnetServer.cs","lineNumber":480,"sourceCode":"                , Tsavorite.core.StoreFunctions.Create(new GarnetKeyComparer(),\n                    () => new GarnetObjectSerializer(customCommandManager),\n                    new GarnetRecordTriggers(cacheSizeTracker, rangeIndexManager, vectorManager))\n                , (allocatorSettings, storeFunctions) => new(allocatorSettings, storeFunctions));\n\n            if (kvSettings.LogMemorySize > 0 || kvSettings.ReadCacheMemorySize > 0)\n            {\n                cacheSizeTracker.Initialize(store, kvSettings.LogMemorySize, kvSettings.ReadCacheMemorySize, this.loggerFactory);\n                sizeTracker = cacheSizeTracker;\n            }\n            return store;\n        }\n\n        private GarnetAppendOnlyFile CreateAOF(int dbId)\n        {\n            if (!opts.EnableAOF)\n            {\n                if (opts.CommitFrequencyMs != 0 || opts.WaitForCommit)\n                    throw new Exception(\"Cannot use CommitFrequencyMs or CommitWait without EnableAOF\");\n                return null;\n            }\n\n            if (opts.FastAofTruncate && opts.CommitFrequencyMs != -1)\n                throw new Exception(\"Need to set CommitFrequencyMs to -1 (manual commits) with FastAofTruncate\");\n\n            opts.GetAofSettings(dbId, out var aofSettings);\n            var appendOnlyFile = new GarnetAppendOnlyFile(opts, aofSettings, logger: this.loggerFactory?.CreateLogger(\"GarnetLog [aof]\"));\n\n            if (opts.CommitFrequencyMs < 0 && opts.WaitForCommit)\n                throw new Exception(\"Cannot use CommitWait with manual commits\");\n            return appendOnlyFile;\n        }\n\n        /// <summary>\n        /// Start server instance\n        /// </summary>\n        public void Start()","sourceCodeStart":462,"sourceCodeEnd":498,"githubUrl":"https://github.com/microsoft/garnet/blob/951b0fc6838721f89d102c2bbe1b914e8d39d700/libs/host/GarnetServer.cs#L462-L498","documentation":"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.","triggerScenarios":"Configuring GarnetServerOptions with EnableAOF=false while also setting CommitFrequencyMs to a non-zero value or WaitForCommit=true. The check is at GarnetServer.cs:479.","commonSituations":"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.","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."],"exampleFix":"// before\nvar opts = new GarnetServerOptions\n{\n    EnableAOF = false,\n    CommitFrequencyMs = 1000  // inconsistent\n};\n\n// after: enable AOF\nvar opts = new GarnetServerOptions\n{\n    EnableAOF = true,\n    CommitFrequencyMs = 1000\n};","handlingStrategy":"validation","validationCode":"if (!opts.EnableAOF && (opts.CommitFrequencyMs != 0 || opts.WaitForCommit))\n    throw new InvalidOperationException(\n        \"CommitFrequencyMs and WaitForCommit require EnableAOF=true. \" +\n        \"Either enable AOF or clear these settings.\");","typeGuard":"static bool AreAofSettingsConsistent(GarnetServerOptions opts) =>\n    opts.EnableAOF || (opts.CommitFrequencyMs == 0 && !opts.WaitForCommit);","tryCatchPattern":null,"preventionTips":["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."],"tags":["aof","persistence","configuration","feature-conflict"],"backgroundTag":null,"analyzedSha":"951b0fc6838721f89d102c2bbe1b914e8d39d700","analyzedAt":"2026-08-13T19:01:32.939Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}