{"record":{"id":"dc317d87a52679af","repo":"dotnet/efcore","slug":"the-provisioned-throughput-was-configured-as-manua","errorCode":null,"errorMessage":"The provisioned throughput was configured as manual on '{manualEntityType}', but on '{autoscaleEntityType}' it was configured as autoscale. All entity types mapped to the same container '{container}' must be configured with the same provisioned throughput type.","messagePattern":"The provisioned throughput was configured as manual on '(.+?)', but on '(.+?)' it was configured as autoscale\\. All entity types mapped to the same container '(.+?)' must be configured with the same provisioned throughput type\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Cosmos/Infrastructure/Internal/CosmosModelValidator.cs","lineNumber":307,"sourceCode":"                            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;\n\n                    throw new InvalidOperationException(\n                        CosmosStrings.ThroughputTypeMismatch(manualType.DisplayName(), autoscaleType.DisplayName(), container));\n                }\n            }\n        }\n\n        ValidateContainerIndexing(mappedTypes, container);\n    }\n\n    private static void ValidateContainerIndexing(IReadOnlyList<IEntityType> mappedTypes, string container)\n    {\n        IEntityType? automaticIndexingOwner = null;\n        bool? automaticIndexingEnabled = null;\n        IReadOnlyList<string>? automaticIndexingExceptions = null;\n\n        foreach (var entityType in mappedTypes)\n        {\n            // Only document-root entity types can carry automatic-indexing configuration.\n            // The same setting must apply to every entity type in a shared container.","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/dotnet/efcore/blob/dbf9771522148d61a2467854921bd5dc6f6e6916/src/EFCore.Cosmos/Infrastructure/Internal/CosmosModelValidator.cs#L289-L325","documentation":"Thrown by CosmosModelValidator.ValidateSharedContainerCompatibility when two root entities in the same container agree on the throughput RU number but disagree on whether it is manual vs autoscale. The validator reaches this branch only after the numeric values match, then checks throughput.AutoscaleMaxThroughput == null on one side and not the other. Cosmos requires a single throughput mode per container.","triggerScenarios":"Calling HasThroughput(1000, autoscale: true) on one entity and HasThroughput(1000, autoscale: false) on another entity mapped to the same container.","commonSituations":"Migrating from manual to autoscale provisioning but only updating one entity; copy-paste where the autoscale flag was dropped; a config helper that defaults autoscale differently per caller.","solutions":["Use the same autoscale flag (true or false) on every root entity in the container, keeping the RU value identical.","Centralize the throughput+autoscale choice in one config call applied to all roots.","Remove redundant HasThroughput calls so only one entity declares it."],"exampleFix":"// before\nmodelBuilder.Entity<Invoice>().ToContainer(\"billing\").HasThroughput(1000, autoscale: true);\nmodelBuilder.Entity<Receipt>().ToContainer(\"billing\").HasThroughput(1000, autoscale: false);\n\n// after\nmodelBuilder.Entity<Invoice>().ToContainer(\"billing\").HasThroughput(1000, autoscale: true);\nmodelBuilder.Entity<Receipt>().ToContainer(\"billing\").HasThroughput(1000, autoscale: true);","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 modes = grp.Select(e => e.GetThroughput()?.AutoscaleMaxThroughput is null ? \"manual\" : \"autoscale\").Distinct().ToList();\n    Debug.Assert(modes.Count <= 1, $\"Container {grp.Key} mixes manual/autoscale throughput\");\n}","typeGuard":null,"tryCatchPattern":"try { ctx.Model.GetModel(); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"configured as manual\"))\n{\n    logger.LogError(ex, \"Throughput type (manual vs autoscale) mismatch in shared container\");\n    throw;\n}","preventionTips":["Decide manual-vs-autoscale once per container and keep it in a constant.","Apply throughput config from one helper to avoid diverging flags.","Test the model to catch this before runtime."],"tags":["cosmos","configuration","model-validation","throughput","autoscale","shared-container"],"analyzedSha":"dbf9771522148d61a2467854921bd5dc6f6e6916","analyzedAt":"2026-08-06T20:46:03.226Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}