{"record":{"id":"0de4ab2aae1ca184","repo":"dotnet/orleans","slug":"compactionsizethreshold-must-be-positive","errorCode":null,"errorMessage":"CompactionSizeThreshold must be positive.","messagePattern":"CompactionSizeThreshold must be positive\\.","errorType":"validation","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"src/Azure/Orleans.Journaling.AzureStorage/AzureTableJournalStorage.cs","lineNumber":1275,"sourceCode":"            AzureTableJournalStorageInstruments instruments,\n            string? journalFormatKey = null)\n        {\n            ArgumentNullException.ThrowIfNull(logger);\n            ArgumentNullException.ThrowIfNull(options);\n            ArgumentNullException.ThrowIfNull(tableClientProvider);\n\n            Logger = logger;\n            Options = options.Value;\n            ArgumentNullException.ThrowIfNull(Options);\n            AzureTableJournalStorageOptions.ValidateTableName(Options.TableName);\n            if (Options.CompactionRowCountThreshold <= 0)\n            {\n                throw new ArgumentOutOfRangeException(nameof(options), $\"{nameof(AzureTableJournalStorageOptions.CompactionRowCountThreshold)} must be positive.\");\n            }\n\n            if (Options.CompactionSizeThreshold <= 0)\n            {\n                throw new ArgumentOutOfRangeException(nameof(options), $\"{nameof(AzureTableJournalStorageOptions.CompactionSizeThreshold)} must be positive.\");\n            }\n\n            if (Options.MaxMetadataOnlyConflictRetries < 0)\n            {\n                throw new ArgumentOutOfRangeException(nameof(options), $\"{nameof(AzureTableJournalStorageOptions.MaxMetadataOnlyConflictRetries)} must be non-negative.\");\n            }\n\n            if (Options.MetadataOnlyConflictInitialBackoff < TimeSpan.Zero)\n            {\n                throw new ArgumentOutOfRangeException(nameof(options), $\"{nameof(AzureTableJournalStorageOptions.MetadataOnlyConflictInitialBackoff)} must be non-negative.\");\n            }\n\n            if (Options.MetadataOnlyConflictMaxBackoff < TimeSpan.Zero)\n            {\n                throw new ArgumentOutOfRangeException(nameof(options), $\"{nameof(AzureTableJournalStorageOptions.MetadataOnlyConflictMaxBackoff)} must be non-negative.\");\n            }\n\n            JournalFormatKey = journalFormatKey;","sourceCodeStart":1257,"sourceCodeEnd":1293,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/Azure/Orleans.Journaling.AzureStorage/AzureTableJournalStorage.cs#L1257-L1293","documentation":"AzureTableJournalStorageOptions.CompactionSizeThreshold was set to zero or negative. The constructor (AzureTableJournalStorage.cs:1273) requires it positive because it bounds the byte-size trigger for IsCompactionRequested. The argument blamed is `options`.","triggerScenarios":"Configuring CompactionSizeThreshold <= 0; thrown at AzureTableJournalStorage.cs:1275 during AzureTableJournalStorageShared construction.","commonSituations":"Missing config binding produced 0; attempt to disable size compaction via 0 (use a large value instead); unit of measure mismatch led to a tiny/zero number.","solutions":["Set CompactionSizeThreshold to a positive byte count (default 32 MiB).","Use a large threshold instead of 0 to effectively defer compaction.","Add IValidateOptions<T> to catch this at startup."],"exampleFix":"// before\noptions.CompactionSizeThreshold = 0;\n\n// after\noptions.CompactionSizeThreshold = AzureTableJournalStorageOptions.DEFAULT_COMPACTION_SIZE_THRESHOLD;","handlingStrategy":"validation","validationCode":"if (options.CompactionSizeThreshold <= 0)\n    throw new ArgumentOutOfRangeException(nameof(options.CompactionSizeThreshold), \"Must be positive\");","typeGuard":"static bool IsValidCompactionSizeThreshold(long v) => v > 0;","tryCatchPattern":null,"preventionTips":["Use IValidateOptions<T> to fail at startup.","Set a large threshold instead of 0 to defer compaction.","Double-check byte vs KB/MB units."],"tags":["configuration","options","validation"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}