microsoft/FASTER · error · FasterException

LogSettings.LogDevice needs to be specified (e.g., use…

Error message

LogSettings.LogDevice needs to be specified (e.g., use Devices.CreateLogDevice, AzureStorageDevice, or NullDevice)

What it means

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.

Solutions

  1. Set settings.LogDevice = Devices.CreateLogDevice(path) before constructing the store.
  2. Use a factory-provided device: AzureStorageDevice for cloud storage, or new NullDevice() for in-memory/test scenarios.
  3. If using the in-memory variant, pass Devices.CSS.Log (legacy shorthand) or an explicit NullDevice-backed configuration.

Example fix

// before
var settings = new LogSettings { PageSizeBits = 25, MemorySizeBits = 28 };
var fht = new FasterKV<Key, Value>(1L << 20, settings);

// after
var settings = new LogSettings {
  LogDevice = Devices.CreateLogDevice("./faster.log"),
  PageSizeBits = 25,
  MemorySizeBits = 28
};
var fht = new FasterKV<Key, Value>(1L << 20, settings);
Defensive patterns

Strategy: validation

Validate before calling

if (settings.LogDevice == null)
    throw new ArgumentException("LogSettings.LogDevice must be set (Devices.CreateLogDevice, AzureStorageDevice, or NullDevice)");

Type guard

bool HasLogDevice(LogSettings s) => s?.LogDevice != null;

Try / catch

try { var fht = new FasterKV<K, V>(size, settings); }
catch (FasterException ex) when (ex.Message.Contains("LogDevice needs to be specified")) { /* fix config and retry */ }

Prevention

When it happens

Trigger: Constructing FasterKV/AllocatorBase with a LogSettings instance where LogSettings.LogDevice was never assigned (left as default null).

Common situations: 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.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of microsoft/FASTER@321d872eab (2026-09-15). Data as JSON: /api/errors/d188d05e4f8052aa. Report an issue: GitHub.

Appendix: source

Thrown at cs/src/core/Allocator/AllocatorBase.cs:964

        #endregion

        protected readonly ILogger logger;

        /// <summary>
        /// Instantiate base allocator
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="comparer"></param>
        /// <param name="evictCallback"></param>
        /// <param name="epoch"></param>
        /// <param name="flushCallback"></param>
        /// <param name="logger"></param>
        public AllocatorBase(LogSettings settings, IFasterEqualityComparer<Key> comparer, Action<long, long> evictCallback, LightEpoch epoch, Action<CommitInfo> flushCallback, ILogger logger = null)
        {
            this.logger = logger;
            if (settings.LogDevice == null)
            {
                throw new FasterException("LogSettings.LogDevice needs to be specified (e.g., use Devices.CreateLogDevice, AzureStorageDevice, or NullDevice)");
            }
            if (evictCallback != null)
            {
                ReadCache = true;
                EvictCallback = evictCallback;
            }
            FlushCallback = flushCallback;
            PreallocateLog = settings.PreallocateLog;
            this.FlushEvent.Initialize();

            if (settings.LogDevice is NullDevice)
                IsNullDevice = true;

            this.comparer = comparer;
            if (epoch == null)
            {
                this.epoch = new LightEpoch();
                ownedEpoch = true;

View on GitHub (pinned to 321d872eab)