dotnet/efcore · error · InvalidOperationException
The provisioned throughput was configured as manual on
Error message
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. What it means
Thrown when one entity type in a shared container configures throughput as MANUAL (HasThroughput with a plain RU value) and another configures it as AUTOSCALE (HasAutoscaleThroughput with an autoscale max). Cosmos requires the entire container to use one throughput mode. The validator detects that one side has AutoscaleMaxThroughput null while the other does not.
Solutions
- Decide container-wide whether to use manual or autoscale throughput, then update every entity in that container to use the same mode (HasThroughput for all, or HasAutoscaleThroughput for all).
- Prefer autoscale for unpredictable workloads or manual for steady workloads; do not mix.
- Centralize the throughput configuration in one place (e.g. a model extension) so it cannot diverge.
Example fix
// before
modelBuilder.Entity<A>().ToContainer("C").HasThroughput(400); // manual
modelBuilder.Entity<B>().ToContainer("C").HasAutoscaleThroughput(4000); // autoscale
// after (all autoscale)
modelBuilder.Entity<A>().ToContainer("C").HasAutoscaleThroughput(4000);
modelBuilder.Entity<B>().ToContainer("C").HasAutoscaleThroughput(4000); Defensive patterns
Strategy: validation
Validate before calling
foreach (var g in dbContext.Model.GetEntityTypes().GroupBy(e => e.GetContainer()))
{
bool? autoscale = null;
foreach (var e in g)
{
var t = e.GetThroughput();
if (t is null) continue;
bool isAuto = t.AutoscaleMaxThroughput != null;
if (autoscale is null) autoscale = isAuto;
else if (autoscale != isAuto) throw new InvalidOperationException($"Throughput mode mismatch on {g.Key}");
}
} Prevention
- Pick manual OR autoscale per container and apply it consistently.
- Centralize the throughput-mode decision in one extension method.
- Validate the model in CI to catch mixed modes.
When it happens
Trigger: Two entity types mapped to the same container where one calls HasThroughput(n) and the other calls HasAutoscaleThroughput(m). Fires during model validation on first model use.
Common situations: Switching a workload from manual to autoscale provisioning but only updating one entity's config; merging code branches where one used manual and the other autoscale; misunderstanding that manual-vs-autoscale is a container-wide decision.
Related errors
- The provisioned throughput was configured to
- A full-text index is defined for
- A full-text index on
- A partition key is defined on entity type
- A vector index is defined for
AI-assisted analysis of dotnet/efcore@3a2006ef56 (2026-08-11).
Data as JSON: /api/errors/dc317d87a52679af.
Report an issue: GitHub.
Appendix: source
Thrown at src/EFCore.Cosmos/Infrastructure/Internal/CosmosModelValidator.cs:307
throughput.AutoscaleMaxThroughput ?? throughput.Throughput,
conflictingEntityType.DisplayName(),
entityType.DisplayName(),
currentThroughput.AutoscaleMaxThroughput ?? currentThroughput.Throughput,
container));
}
else if (throughput.AutoscaleMaxThroughput
== null
!= (currentThroughput.AutoscaleMaxThroughput == null))
{
var conflictingEntityType = mappedTypes.First(et => et.GetThroughput() != null);
var autoscaleType = throughput.AutoscaleMaxThroughput == null
? entityType
: conflictingEntityType;
var manualType = throughput.AutoscaleMaxThroughput != null
? entityType
: conflictingEntityType;
throw new InvalidOperationException(
CosmosStrings.ThroughputTypeMismatch(manualType.DisplayName(), autoscaleType.DisplayName(), container));
}
}
}
ValidateContainerIndexing(mappedTypes, container);
}
private static void ValidateContainerIndexing(IReadOnlyList<IEntityType> mappedTypes, string container)
{
IEntityType? automaticIndexingOwner = null;
bool? automaticIndexingEnabled = null;
IReadOnlyList<string>? automaticIndexingExceptions = null;
foreach (var entityType in mappedTypes)
{
// Only document-root entity types can carry automatic-indexing configuration.
// The same setting must apply to every entity type in a shared container.View on GitHub (pinned to 3a2006ef56)