{"record":{"id":"71e0ba860b02fb1a","repo":"microsoft/garnet","slug":"logdir-specified-without-enabling-tiered-storage","errorCode":null,"errorMessage":"LogDir specified without enabling tiered storage (UseStorage)","messagePattern":"LogDir specified without enabling tiered storage \\(UseStorage\\)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"libs/server/Servers/GarnetServerOptions.cs","lineNumber":809,"sourceCode":"                    logger?.LogInformation(\"[Store] No Read cache log memory size limit will be enforced\");\n                }\n            }\n\n            if (EnableStorageTier)\n            {\n                if (LogDir is null or \"\")\n                    LogDir = Directory.GetCurrentDirectory();\n                logFactory = GetInitializedDeviceFactory(LogDir);\n\n                // These must match GetInitializedSegmentFileDevice.GetStoreHLogDevice\n                kvSettings.LogDevice = logFactory.Get(new FileDescriptor(\"Store\", \"hlog\"));\n                if (!DisableObjects)\n                    kvSettings.ObjectLogDevice = logFactory.Get(new FileDescriptor(\"Store\", \"hlog_objs\"));\n            }\n            else\n            {\n                if (LogDir != null)\n                    throw new Exception(\"LogDir specified without enabling tiered storage (UseStorage)\");\n                kvSettings.LogDevice = new NullDevice();\n                logFactory = null;\n            }\n\n            if (CopyReadsToTail)\n                kvSettings.ReadCopyOptions = new(ReadCopyFrom.AllImmutable, ReadCopyTo.MainLog);\n\n            if (RevivInChainOnly)\n            {\n                logger?.LogInformation(\"[Store] Using Revivification in-chain only\");\n                kvSettings.RevivificationSettings = RevivificationSettings.InChainOnly.Clone();\n            }\n            else if (UseRevivBinsPowerOf2)\n            {\n                logger?.LogInformation(\"[Store] Using Revivification with power-of-2 bins\");\n                kvSettings.RevivificationSettings = RevivificationSettings.PowerOf2Bins.Clone();\n                kvSettings.RevivificationSettings.NumberOfBinsToSearch = RevivNumberOfBinsToSearch;\n                kvSettings.RevivificationSettings.RevivifiableFraction = RevivifiableFraction;","sourceCodeStart":791,"sourceCodeEnd":827,"githubUrl":"https://github.com/microsoft/garnet/blob/951b0fc6838721f89d102c2bbe1b914e8d39d700/libs/server/Servers/GarnetServerOptions.cs#L791-L827","documentation":"LogDir specifies the on-disk directory for tiered (hybrid-log) records. If LogDir is set but storage tiering is disabled, GetSettings treats it as a contradictory config and throws, because without tiering the store uses a NullDevice and the directory would never be used. The message references the legacy flag name UseStorage.","triggerScenarios":"Starting with --logdir/-l set but --storage-tier not enabled. Thrown at GarnetServerOptions.cs:808-809 (the else-branch taken when EnableStorageTier is false).","commonSituations":"Setting a log directory intending to persist data while forgetting to enable the storage tier; stale config from a version where tiering was implied; misunderstanding that LogDir alone does not enable persistence.","solutions":["Enable storage tiering so LogDir is honored: add --storage-tier.","If you truly want an in-memory-only store (NullDevice), remove --logdir.","Review the config so LogDir and --storage-tier are always paired."],"exampleFix":"# before (fails)\ngarnet-server --logdir /data/garnet\n\n# after\ngarnet-server --storage-tier --logdir /data/garnet","handlingStrategy":"validation","validationCode":"if (!options.EnableStorageTier && !string.IsNullOrEmpty(options.LogDir)) {\n    throw new InvalidOperationException(\"LogDir requires EnableStorageTier (--storage-tier)\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pair --logdir with --storage-tier, or omit both for an in-memory store.","Validate that persistence flags imply tiering in config checks."],"tags":["garnet","config","storage","dotnet"],"backgroundTag":null,"analyzedSha":"951b0fc6838721f89d102c2bbe1b914e8d39d700","analyzedAt":"2026-08-13T19:01:32.939Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}