microsoft/aspire · error · InvalidOperationException
A recipe parameter on Radius environment
Error message
A recipe parameter on Radius environment '{_environment.Name}' references AWS provider configuration, but no AWS provider is configured. Call WithAwsProvider(...) on the environment. What it means
While building the Radius environment infrastructure, a recipe parameter references a provider scope field (here RadiusProviderScopeField.Region from AWS provider configuration), but the environment has no AWS provider registered (the RadiusCloudProvidersAnnotation is missing or its Aws section is null). MissingProviderReference throws so the publish fails with an actionable message instead of emitting a manifest with an unresolved scope. The fix is to configure the provider with WithAwsProvider on the environment.
Solutions
- Call .WithAwsProvider(...) on the Radius environment builder with the required scope (region/account).
- Verify the environment's RadiusCloudProvidersAnnotation actually populates Aws (Region/AccountId), not just Azure.
- If the parameter should use Azure instead, change the recipe parameter's scope field so it no longer references AWS.
- Re-run publish after provider configuration; check the generated environment manifest shows the aws provider entry.
Example fix
// before
var env = builder.AddRadiusEnvironment("env"); // no AWS provider, recipe needs AWS Region
// after
var env = builder.AddRadiusEnvironment("env")
.WithAwsProvider(region: "us-west-2", account: "123456789012"); Defensive patterns
Strategy: validation
Validate before calling
// verify the environment has AWS provider config before publish
var ann = environment.Annotations.OfType<RadiusCloudProvidersAnnotation>().FirstOrDefault();
if (ann?.Aws?.Region is null) throw new InvalidOperationException("Environment needs .WithAwsProvider(...) before recipes referencing AWS scope."); Try / catch
try {
await publishPipeline.ExecuteAsync(ct);
} catch (InvalidOperationException ex) when (ex.Message.Contains("WithAwsProvider")) {
// configure the AWS provider on the environment and republish
} Prevention
- Configure WithAwsProvider on every Radius environment used by AWS-backed recipes.
- Keep environment setup in a shared helper so providers are never omitted when copying code.
- Review the environment manifest for an aws provider block before publishing.
When it happens
Trigger: Publishing to a Radius environment where a recipe parameter uses an AWS scope field (Region) via WithAwsProvider-independent recipe references, but the environment builder was never given `.WithAwsProvider(...)` — so `providers?.Aws?.Region` is null and the null-coalescing throw fires.
Common situations: Deploying an app that uses AWS-backed recipes to an environment configured only for Azure; forgetting WithAwsProvider after adding AWS recipe parameters; copying environment setup code that dropped the AWS provider registration; annotation present but Aws block empty.
Related errors
- A recipe parameter on Radius environment
- A ConfigureRadiusInfrastructure callback removed or…
- ASPIRERADIUS010
- ASPIRERADIUS011
- ASPIRERADIUS059
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/d8a83d2b257a5775.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Hosting.Radius/Publishing/RadiusInfrastructureBuilder.cs:5475
return provisioningParameter;
}
/// <summary>
/// Resolves a <see cref="RadiusProviderReference"/> to the corresponding scope value from the
/// cloud provider configured on this environment. Throws when the referenced provider is not
/// configured.
/// </summary>
private string ResolveProviderReference(RadiusProviderReference reference)
{
var providers = _environment.Annotations
.OfType<Annotations.RadiusCloudProvidersAnnotation>()
.FirstOrDefault();
return reference.Field switch
{
RadiusProviderScopeField.Region =>
providers?.Aws?.Region ?? throw MissingProviderReference("AWS", "WithAwsProvider"),
RadiusProviderScopeField.AccountId =>
providers?.Aws?.AccountId ?? throw MissingProviderReference("AWS", "WithAwsProvider"),
RadiusProviderScopeField.SubscriptionId =>
providers?.Azure?.SubscriptionId ?? throw MissingProviderReference("Azure", "WithAzureProvider"),
RadiusProviderScopeField.ResourceGroup =>
providers?.Azure?.ResourceGroup ?? throw MissingProviderReference("Azure", "WithAzureProvider"),
_ => throw new NotSupportedException($"Unknown provider scope field '{reference.Field}'."),
};
}
private InvalidOperationException MissingProviderReference(string cloud, string configureMethod) =>
new($"A recipe parameter on Radius environment '{_environment.Name}' references {cloud} provider " +
$"configuration, but no {cloud} provider is configured. Call {configureMethod}(...) on the environment.");
/// <summary>
/// Emits a non-fatal warning for each resource-type-scoped parameter set whose resource type
/// has no recipe entry in the emitted recipe pack.
/// </summary>View on GitHub (pinned to 25830f84bd)