{"record":{"id":"7f13f9dc5c257980","repo":"microsoft/FASTER","slug":"cannot-use-scanuncommitted-without-setting","errorCode":null,"errorMessage":"Cannot use scanUncommitted without setting AutoRefreshSafeTailAddress to true in FasterLog settings","messagePattern":"Cannot use scanUncommitted without setting AutoRefreshSafeTailAddress to true in FasterLog settings","errorType":"exception","errorClass":"FasterException","httpStatus":null,"severity":"error","filePath":"cs/src/core/FasterLog/FasterLog.cs","lineNumber":1824,"sourceCode":"        /// <param name=\"recover\">Whether to recover named iterator from latest commit (if exists). If false, iterator starts from beginAddress.</param>\n        /// <param name=\"scanBufferingMode\">Use single or double buffering</param>\n        /// <param name=\"scanUncommitted\">Whether we scan uncommitted data</param>\n        /// <param name=\"logger\"></param>\n        /// <returns></returns>\n        public FasterLogScanIterator Scan(long beginAddress, long endAddress, string name = null, bool recover = true, ScanBufferingMode scanBufferingMode = ScanBufferingMode.DoublePageBuffering, bool scanUncommitted = false, ILogger logger = null)\n        {\n            if (readOnlyMode)\n            {\n                scanBufferingMode = ScanBufferingMode.SinglePageBuffering;\n\n                if (name != null)\n                    throw new FasterException(\"Cannot use named iterators with read-only FasterLog\");\n                if (scanUncommitted)\n                    throw new FasterException(\"Cannot use scanUncommitted with read-only FasterLog\");\n            }\n\n            if (scanUncommitted && !AutoRefreshSafeTailAddress)\n                throw new FasterException(\"Cannot use scanUncommitted without setting AutoRefreshSafeTailAddress to true in FasterLog settings\");\n\n            FasterLogScanIterator iter;\n            if (recover && name != null && RecoveredIterators != null && RecoveredIterators.ContainsKey(name))\n                iter = new FasterLogScanIterator(this, allocator, RecoveredIterators[name], endAddress, getMemory, scanBufferingMode, epoch, headerSize, name, scanUncommitted, logger: logger);\n            else\n                iter = new FasterLogScanIterator(this, allocator, beginAddress, endAddress, getMemory, scanBufferingMode, epoch, headerSize, name, scanUncommitted, logger: logger);\n\n            if (name != null)\n            {\n                if (name.Length > 20)\n                    throw new FasterException(\"Max length of iterator name is 20 characters\");\n                if (PersistedIterators.ContainsKey(name))\n                    logger?.LogDebug(\"Iterator name exists, overwriting\");\n                PersistedIterators[name] = iter;\n            }\n\n            if (Interlocked.Increment(ref logRefCount) == 1)\n                throw new FasterException(\"Cannot scan disposed log instance\");","sourceCodeStart":1806,"sourceCodeEnd":1842,"githubUrl":"https://github.com/microsoft/FASTER/blob/321d872eabda6a0345c8bd76419f89723ed864ae/cs/src/core/FasterLog/FasterLog.cs#L1806-L1842","documentation":"FasterLog's Scan (iterator) API rejects scanUncommitted=true when the log was not created with AutoRefreshSafeTailAddress=true. Scanning uncommitted entries requires the log's safe tail address to be continuously refreshed, which only happens when that setting is enabled. The library throws eagerly at iterator creation in FasterLog.cs:1824 rather than producing subtly stale iteration results.","triggerScenarios":"Calling FasterLog.Scan/Scan(beginAddress, endAddress, name, scanUncommitted: true, ...) on a log whose FasterLogSettings.AutoRefreshSafeTailAddress was not set to true.","commonSituations":"Developers building tailing/follow-the-tail iterators over the log enable scanUncommitted but forget the companion setting in the FasterLogSettings used at construction; also common when copying iterator code from samples that used a read-only log configured differently.","solutions":["Set FasterLogSettings.AutoRefreshSafeTailAddress = true when creating the FasterLog instance, then reopen it.","If uncommitted scanning is not required, pass scanUncommitted: false to Scan.","If using a read-only log instance for tailing, verify the settings used to construct it enable AutoRefreshSafeTailAddress."],"exampleFix":"// before\nvar log = new FasterLog(new FasterLogSettings { LogDevice = device });\nvar iter = log.Scan(0, long.MaxValue, scanUncommitted: true);\n// after\nvar log = new FasterLog(new FasterLogSettings { LogDevice = device, AutoRefreshSafeTailAddress = true });\nvar iter = log.Scan(0, long.MaxValue, scanUncommitted: true);","handlingStrategy":"validation","validationCode":"// before creating a tailing iterator\nif (scanUncommitted && !logSettings.AutoRefreshSafeTailAddress)\n    throw new InvalidOperationException(\"scanUncommitted requires FasterLogSettings.AutoRefreshSafeTailAddress = true\");","typeGuard":null,"tryCatchPattern":"try { var iter = log.Scan(0, long.MaxValue, scanUncommitted: true); } catch (FasterException ex) when (ex.Message.Contains(\"AutoRefreshSafeTailAddress\")) { /* fix settings or use scanUncommitted:false */ }","preventionTips":["Centralize FasterLogSettings creation so tailing-related flags are set together.","Pair scanUncommitted with AutoRefreshSafeTailAddress in a wrapper method.","Add a startup config assertion that both flags agree."],"tags":["fasterlog","iterator","configuration","csharp"],"backgroundTag":"conflicting-config-options","analyzedSha":"321d872eabda6a0345c8bd76419f89723ed864ae","analyzedAt":"2026-09-15T22:18:00.693Z","contentChangedAt":"2026-09-15T22:18:00.693Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}