{"record":{"id":"d188d05e4f8052aa","repo":"microsoft/FASTER","slug":"logsettings-logdevice-needs-to-be-specified-e-g-use-devices","errorCode":null,"errorMessage":"LogSettings.LogDevice needs to be specified (e.g., use Devices.CreateLogDevice, AzureStorageDevice, or NullDevice)","messagePattern":"LogSettings\\.LogDevice needs to be specified \\(e\\.g\\., use Devices\\.CreateLogDevice, AzureStorageDevice, or NullDevice\\)","errorType":"exception","errorClass":"FasterException","httpStatus":null,"severity":"error","filePath":"cs/src/core/Allocator/AllocatorBase.cs","lineNumber":964,"sourceCode":"        #endregion\n\n        protected readonly ILogger logger;\n\n        /// <summary>\n        /// Instantiate base allocator\n        /// </summary>\n        /// <param name=\"settings\"></param>\n        /// <param name=\"comparer\"></param>\n        /// <param name=\"evictCallback\"></param>\n        /// <param name=\"epoch\"></param>\n        /// <param name=\"flushCallback\"></param>\n        /// <param name=\"logger\"></param>\n        public AllocatorBase(LogSettings settings, IFasterEqualityComparer<Key> comparer, Action<long, long> evictCallback, LightEpoch epoch, Action<CommitInfo> flushCallback, ILogger logger = null)\n        {\n            this.logger = logger;\n            if (settings.LogDevice == null)\n            {\n                throw new FasterException(\"LogSettings.LogDevice needs to be specified (e.g., use Devices.CreateLogDevice, AzureStorageDevice, or NullDevice)\");\n            }\n            if (evictCallback != null)\n            {\n                ReadCache = true;\n                EvictCallback = evictCallback;\n            }\n            FlushCallback = flushCallback;\n            PreallocateLog = settings.PreallocateLog;\n            this.FlushEvent.Initialize();\n\n            if (settings.LogDevice is NullDevice)\n                IsNullDevice = true;\n\n            this.comparer = comparer;\n            if (epoch == null)\n            {\n                this.epoch = new LightEpoch();\n                ownedEpoch = true;","sourceCodeStart":946,"sourceCodeEnd":982,"githubUrl":"https://github.com/microsoft/FASTER/blob/321d872eabda6a0345c8bd76419f89723ed864ae/cs/src/core/Allocator/AllocatorBase.cs#L946-L982","documentation":"AllocatorBase's constructor requires a non-null LogDevice in LogSettings; FASTER needs a device to back the hybrid log. If settings.LogDevice is null the allocator cannot be constructed, so it throws immediately. This is a mandatory configuration check, not a runtime failure.","triggerScenarios":"Constructing FasterKV/AllocatorBase with a LogSettings instance where LogSettings.LogDevice was never assigned (left as default null).","commonSituations":"New users building LogSettings() and setting only MemorySizeBits/PageSizeBits but forgetting the log device; test code creating settings programmatically; migrating code that previously used factory helpers which set the device automatically.","solutions":["Set settings.LogDevice = Devices.CreateLogDevice(path) before constructing the store.","Use a factory-provided device: AzureStorageDevice for cloud storage, or new NullDevice() for in-memory/test scenarios.","If using the in-memory variant, pass Devices.CSS.Log (legacy shorthand) or an explicit NullDevice-backed configuration."],"exampleFix":"// before\nvar settings = new LogSettings { PageSizeBits = 25, MemorySizeBits = 28 };\nvar fht = new FasterKV<Key, Value>(1L << 20, settings);\n\n// after\nvar settings = new LogSettings {\n  LogDevice = Devices.CreateLogDevice(\"./faster.log\"),\n  PageSizeBits = 25,\n  MemorySizeBits = 28\n};\nvar fht = new FasterKV<Key, Value>(1L << 20, settings);","handlingStrategy":"validation","validationCode":"if (settings.LogDevice == null)\n    throw new ArgumentException(\"LogSettings.LogDevice must be set (Devices.CreateLogDevice, AzureStorageDevice, or NullDevice)\");","typeGuard":"bool HasLogDevice(LogSettings s) => s?.LogDevice != null;","tryCatchPattern":"try { var fht = new FasterKV<K, V>(size, settings); }\ncatch (FasterException ex) when (ex.Message.Contains(\"LogDevice needs to be specified\")) { /* fix config and retry */ }","preventionTips":["Always initialize LogDevice before constructing FasterKV; use a shared settings-builder helper.","Use NullDevice explicitly for in-memory/test scenarios.","Validate the whole LogSettings (device, page/memory bits) in one factory method."],"tags":["csharp","configuration","faster","log-device"],"backgroundTag":"missing-required-config-field","analyzedSha":"321d872eabda6a0345c8bd76419f89723ed864ae","analyzedAt":"2026-09-15T22:18:00.693Z","contentChangedAt":"2026-09-15T22:18:00.693Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}