microsoft/aspire · error · InvalidOperationException
ASPIRERADIUS072
ASPIRERADIUS072
Error message
Resource '${resource.Name}' has a Radius recipe that provisions the single database '${selectedDatabaseName}', but '${string.Join("', '", wronglyConsumed)}' ${(wronglyConsumed.Count == 1 ? "is" : "are")} also consumed by the application, so those consumers would receive a connection string naming a database the deployment will not contain. Consume only '${selectedDatabaseName}', or declare one database per resource. Diagnostic: ASPIRERADIUS072. What it means
A Radius recipe that provisions a single fixed database is combined with consumers that reference other database names, so those consumers would receive connection strings pointing at a database the deployment will not contain. The builder rejects the model instead of producing a deployment that fails at runtime.
Solutions
- Change consumers so they only reference the database name the recipe provisions (selectedDatabaseName).
- Declare one database per resource if the application needs multiple databases.
- Remove the extra database references from the application model.
Example fix
// before
var db1 = builder.AddPostgres("pg").AddDatabase("orders");
var db2 = builder.AddPostgres("pg").AddDatabase("billing");
// after
var orders = builder.AddPostgres("pg").AddDatabase("orders");
var billing = builder.AddPostgres("pg-billing").AddDatabase("billing"); Defensive patterns
Strategy: validation
Validate before calling
var consumed = model.GetConsumedDatabases(resource); var provisioned = recipe.ProvisionedDatabases; if (consumed.Any(d => !provisioned.Contains(d))) throw new InvalidOperationException("Recipe does not provision all consumed databases."); Prevention
- Only reference database names the recipe actually provisions.
- Use one resource (and recipe) per database when the application needs multiple databases.
- Review AddDatabase references after changing a backing resource to a single-database recipe.
When it happens
Trigger: Publishing a resource whose recipe provisions exactly one named database (selectedDatabaseName) while the application model consumes other database names (wronglyConsumed) on the same resource.
Common situations: Adding multiple AddDatabase references (e.g. 'db1' and 'db2') against one resource whose recipe only creates one database; copy-pasting database references from a multi-database setup onto a single-database recipe resource.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- ASPIRERADIUS085
- A ConfigureRadiusInfrastructure callback changed port
- A ConfigureRadiusInfrastructure callback left container
- A ConfigureRadiusInfrastructure callback replaced port
- A ConfigureRadiusInfrastructure callback replaced the…
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/7507cb569f2435b4.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Hosting.Radius/Publishing/RadiusInfrastructureBuilder.cs:2375
foreach (var (resource, selectedDatabaseName) in _recipeDatabaseSelections)
{
// Union of both signals, because either one on its own is incomplete: annotations miss a
// callback-only consumer, and the resolved-consumption set misses a database that is
// referenced but whose value no container happened to resolve.
var wronglyConsumed = FindDatabaseChildren(resource)
.Where(d => !string.Equals(GetPhysicalDatabaseName(d), selectedDatabaseName, StringComparison.Ordinal))
.Where(d => referencedResourceNames.Contains(d.Name) ||
_resolvedConnectionStringConsumption.Contains(d.Name))
.Select(GetPhysicalDatabaseName)
.Distinct(StringComparer.Ordinal)
.ToList();
if (wronglyConsumed.Count == 0)
{
continue;
}
throw new InvalidOperationException(
$"Resource '{resource.Name}' has a Radius recipe that provisions the single database " +
$"'{selectedDatabaseName}', but '{string.Join("', '", wronglyConsumed)}' " +
$"{(wronglyConsumed.Count == 1 ? "is" : "are")} also consumed by the application, so those consumers " +
$"would receive a connection string naming a database the deployment will not contain. Consume only " +
$"'{selectedDatabaseName}', or declare one database per resource. Diagnostic: ASPIRERADIUS072.");
}
}
/// <summary>
/// Wires a type whose recipe generates its own credentials and exposes them through
/// <c>listSecrets()</c>: Aspire's parameters are substituted for the recipe's own values
/// wherever they appear, so every composed value carries what is actually deployed.
/// </summary>
private void ApplyListSecretsCredentials(
IResource resource,
IResourceWithConnectionString withConnectionString,
RadiusResourceTypeConstruct construct,
RadiusBackingConnections.RadiusConnectionSchema schema,View on GitHub (pinned to 25830f84bd)