{"record":{"id":"c1b459971a6f24b3","repo":"dotnet/orleans","slug":"the-collection-must-contain-between-1-and-maxtran","errorCode":null,"errorMessage":"The collection must contain between 1 and {maxTransactionSize} rows.","messagePattern":"The collection must contain between 1 and (.+?) rows\\.","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"src/Azure/Shared/Storage/AzureTableDataManager.cs","lineNumber":613,"sourceCode":"                catch (Exception exc)\n                {\n                    LogWarningBulkInsertTableEntries(Logger, exc, collection.Count, TableName);\n                }\n            }\n            finally\n            {\n                CheckAlertSlowAccess(startTime, operation);\n            }\n        }\n\n        internal async Task CreateTableEntriesAsync(IReadOnlyCollection<T> collection)\n        {\n            const string operation = \"CreateTableEntries\";\n            const int maxTransactionSize = 100;\n            ArgumentNullException.ThrowIfNull(collection);\n            if (collection.Count is 0 or > maxTransactionSize)\n            {\n                throw new ArgumentOutOfRangeException(\n                    nameof(collection),\n                    collection.Count,\n                    $\"The collection must contain between 1 and {maxTransactionSize} rows.\");\n            }\n\n            var startTime = DateTime.UtcNow;\n            LogTraceTableEntriesCount(Logger, operation, collection.Count, TableName);\n            try\n            {\n                try\n                {\n                    var transaction = new List<TableTransactionAction>(collection.Count);\n                    foreach (var entry in collection)\n                    {\n                        transaction.Add(new TableTransactionAction(TableTransactionActionType.Add, entry));\n                    }\n\n                    await Table.SubmitTransactionAsync(transaction);","sourceCodeStart":595,"sourceCodeEnd":631,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/Azure/Shared/Storage/AzureTableDataManager.cs#L595-L631","documentation":"ArgumentOutOfRangeException from the internal CreateTableEntriesAsync: the collection must contain between 1 and maxTransactionSize (hard-coded 100) rows. Unlike BulkInsertTableEntries, this method rejects empty collections as well, because it builds a single TableTransactionAction list and a 0-row transaction is meaningless. The 100 cap matches Azure Table entity-group transaction limits.","triggerScenarios":"Calling CreateTableEntriesAsync with collection.Count == 0 or collection.Count > 100. Because it is internal, the trigger is usually another AzureTableDataManager method (e.g. a wrapper that forwards a caller's collection) receiving an empty or oversized input.","commonSituations":"A caller filters a list down to zero rows then forwards it to the create path, or a batch splitter produces a remainder chunk larger than 100 due to an off-by-one. Less commonly, a custom subclass calling the internal method directly.","solutions":["Guard empty collections before calling: if (entries.Count == 0) return; and chunk to <= 100 rows.","Fix the chunking so no sub-batch exceeds 100 (use the same BatchIEnumerable(100) pattern used elsewhere in the file).","Do not call CreateTableEntriesAsync for updates; it issues Create-only TableTransactionActions."],"exampleFix":"// before\nawait mgr.CreateTableEntriesAsync(filtered); // throws if empty or >100\n\n// after\nif (filtered.Count == 0) return;\nforeach (var batch in filtered.BatchIEnumerable(100))\n    await mgr.CreateTableEntriesAsync(batch);","handlingStrategy":"validation","validationCode":"if (collection.Count == 0) return;\nforeach (var batch in collection.BatchIEnumerable(100))\n    await mgr.CreateTableEntriesAsync(batch);","typeGuard":"static bool IsValidCreateBatch(IReadOnlyCollection<T> c) => c.Count is > 0 and <= 100;","tryCatchPattern":null,"preventionTips":["Skip empty collections before the create path","Chunk to the hard 100-row limit","Use CreateTableEntriesAsync only for inserts, not updates"],"tags":["argument-validation","azure-storage","batching","internal-api"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}