{"record":{"id":"502a4eb3309274df","repo":"dotnet/efcore","slug":"the-provisioned-throughput-was-configured-to-thr","errorCode":null,"errorMessage":"The provisioned throughput was configured to '{throughput1}' on '{entityType1}', but on '{entityType2}' it was configured to '{throughput2}'. All entity types mapped to the same container '{container}' must be configured with the same provisioned throughput.","messagePattern":"The provisioned throughput was configured to '(.+?)' on '(.+?)', but on '(.+?)' it was configured to '(.+?)'\\. All entity types mapped to the same container '(.+?)' must be configured with the same provisioned throughput\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Cosmos/Infrastructure/Internal/CosmosModelValidator.cs","lineNumber":287,"sourceCode":"                            conflictingEntityType.DisplayName(),\n                            entityType.DisplayName(),\n                            currentDefaultTtl,\n                            container));\n                }\n            }\n\n            var currentThroughput = entityType.GetThroughput();\n            if (currentThroughput != null)\n            {\n                if (throughput == null)\n                {\n                    throughput = currentThroughput;\n                }\n                else if ((throughput.AutoscaleMaxThroughput ?? throughput.Throughput)\n                         != (currentThroughput.AutoscaleMaxThroughput ?? currentThroughput.Throughput))\n                {\n                    var conflictingEntityType = mappedTypes.First(et => et.GetThroughput() != null);\n                    throw new InvalidOperationException(\n                        CosmosStrings.ThroughputMismatch(\n                            throughput.AutoscaleMaxThroughput ?? throughput.Throughput,\n                            conflictingEntityType.DisplayName(),\n                            entityType.DisplayName(),\n                            currentThroughput.AutoscaleMaxThroughput ?? currentThroughput.Throughput,\n                            container));\n                }\n                else if (throughput.AutoscaleMaxThroughput\n                         == null\n                         != (currentThroughput.AutoscaleMaxThroughput == null))\n                {\n                    var conflictingEntityType = mappedTypes.First(et => et.GetThroughput() != null);\n                    var autoscaleType = throughput.AutoscaleMaxThroughput == null\n                        ? entityType\n                        : conflictingEntityType;\n                    var manualType = throughput.AutoscaleMaxThroughput != null\n                        ? entityType\n                        : conflictingEntityType;","sourceCodeStart":269,"sourceCodeEnd":305,"githubUrl":"https://github.com/dotnet/efcore/blob/dbf9771522148d61a2467854921bd5dc6f6e6916/src/EFCore.Cosmos/Infrastructure/Internal/CosmosModelValidator.cs#L269-L305","documentation":"Thrown by CosmosModelValidator.ValidateSharedContainerCompatibility when two document-root entity types sharing a container declare different provisioned throughput values via HasThroughput(). The validator compares throughput.AutoscaleMaxThroughput ?? throughput.Throughput across types; a numeric mismatch throws. Throughput is a container-level Cosmos property, so EF forbids contradictory configuration.","triggerScenarios":"Calling modelBuilder.Entity<A>().HasThroughput(400) and modelBuilder.Entity<B>().HasThroughput(1000) where A and B share a container. Fires at model validation time.","commonSituations":"Tuning RU/s on one entity during load testing and forgetting the others in the shared container; different teams provisioning throughput independently for entities that end up co-located; merging two contexts that each set throughput.","solutions":["Set the same HasThroughput(RU) value on every root entity in the container.","Set throughput on exactly one root entity and remove it from the rest.","Consider database-level throughput instead of per-container if you need a single RU budget."],"exampleFix":"// before\nmodelBuilder.Entity<Invoice>().ToContainer(\"billing\").HasThroughput(400);\nmodelBuilder.Entity<Receipt>().ToContainer(\"billing\").HasThroughput(1000);\n\n// after\nmodelBuilder.Entity<Invoice>().ToContainer(\"billing\").HasThroughput(1000);\nmodelBuilder.Entity<Receipt>().ToContainer(\"billing\").HasThroughput(1000);","handlingStrategy":"validation","validationCode":"using (var ctx = new MyContext()) { ctx.Model.GetModel(); }\nforeach (var grp in ctx.Model.GetEntityTypes()\n    .Where(e => e.FindPrimaryKey() != null && e.GetContainer() != null)\n    .GroupBy(e => e.GetContainer()))\n{\n    var rru = grp.Select(e => e.GetThroughput()?.AutoscaleMaxThroughput ?? e.GetThroughput()?.Throughput).Distinct().ToList();\n    Debug.Assert(rru.Count <= 1, $\"Container {grp.Key} has conflicting throughput\");\n}","typeGuard":null,"tryCatchPattern":"try { ctx.Model.GetModel(); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"provisioned throughput was configured\"))\n{\n    logger.LogError(ex, \"Throughput mismatch in shared Cosmos container\");\n    throw;\n}","preventionTips":["Set throughput on exactly one root entity per container.","Prefer database-level throughput when a single RU budget is desired.","Assert uniform throughput in a model-validation test."],"tags":["cosmos","configuration","model-validation","throughput","shared-container"],"analyzedSha":"dbf9771522148d61a2467854921bd5dc6f6e6916","analyzedAt":"2026-08-06T20:46:03.226Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}