microsoft/aspire · error · RadiusBackingResourceProjectionException

ASPIRERADIUS069

ASPIRERADIUS069

Error message

Resource '${resource.Name}' is deployed by a Radius recipe in a different environment than '${_environment.Name}', so its address cannot be resolved here. Deploy the consumer and '${resource.Name}' to the same Radius environment. Diagnostic: ASPIRERADIUS069.

What it means

During publish, the Radius infrastructure builder projects connection strings for backing resources referenced by a consumer. If a referenced resource was not emitted as a construct in the current Radius environment (it was deployed by a recipe in a different environment), there is no construct to project its address from, so the builder throws RadiusBackingResourceProjectionException with diagnostic ASPIRERADIUS069.

Solutions

  1. Deploy the consumer and the referenced resource into the same Radius environment.
  2. Move the backing resource's definition into the same AppHost/environment as its consumer.
  3. If the resource must stay elsewhere, provision the connection manually (explicit connection string/env var) instead of referencing the recipe-backed resource.

Example fix

// before: consumer in envA references database emitted by envB recipe
var db = builder.AddPostgres("db");
// after: define the database alongside the consumer so both publish to the same Radius environment
var db = builder.AddPostgres("db");
var api = builder.AddProject<Projects.Api>("api").WithReference(db).WaitFor(db);
Defensive patterns

Strategy: validation

Validate before calling

// Before publish, verify referenced backing resources are emitted in the current environment
foreach (var r in appModel.Resources.Where(r => r is IResourceWithWaitSupport || references contain them))
{
    if (!emittedResourceNames.Contains(r.Name))
        throw new InvalidOperationException($"'{r.Name}' is not part of the published Radius environment; move it in or drop the reference.");
}

Try / catch

catch (RadiusBackingResourceProjectionException ex) when (ex.Message.Contains("ASPIRERADIUS069"))
{
    logger.LogError(ex, "Cross-environment reference detected");
}

Prevention

When it happens

Trigger: Publishing an Aspire AppHost with the Radius publisher when resource A references resource B (via WaitFor, GetEndpoint, connection string reference, etc.) but B was provisioned by a recipe in a Radius environment other than the one being published (_typeInstancesByResourceName/_radiusTypeByResourceName lack B's name).

Common situations: A consumer app deployed in one Radius environment references a backing resource (database, cache) whose recipe was deployed in a dev/staging environment; cross-environment resource references after splitting environments; copy-pasting resource definitions between AppHosts with different environments.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16). Data as JSON: /api/errors/8918aff14cca624f. Report an issue: GitHub.

Appendix: source

Thrown at src/Aspire.Hosting.Radius/Publishing/RadiusInfrastructureBuilder.cs:3365

    private bool TryProjectBackingEndpoint(
        EndpointReference endpointReference,
        EndpointProperty property,
        List<EnvPart> parts)
    {
        var resource = ResolveToParent(endpointReference.Resource);

        if (!ResourceTypeMapper.IsBackingResource(resource))
        {
            return false;
        }

        if (!_typeInstancesByResourceName.TryGetValue(resource.Name, out var construct) ||
            !_radiusTypeByResourceName.TryGetValue(resource.Name, out var radiusType))
        {
            // The resource is a backing resource but this environment did not emit it — it belongs
            // to a different Radius environment. There is no construct to project from, and the
            // recipe outputs of another environment's deployment are not reachable from this Bicep.
            throw new RadiusBackingResourceProjectionException(
                resource,
                $"Resource '{resource.Name}' is deployed by a Radius recipe in a different environment than '{_environment.Name}', " +
                $"so its address cannot be resolved here. Deploy the consumer and '{resource.Name}' to the same Radius environment. " +
                $"Diagnostic: ASPIRERADIUS069.");
        }

        if (RadiusBackingConnections.GetSchema(radiusType) is not { } schema)
        {
            throw new RadiusBackingResourceProjectionException(
                resource,
                $"Resource '{resource.Name}' maps to Radius type '{radiusType}', which does not expose an address Aspire can " +
                $"project. Remove the reference, or map the resource to a Radius type that publishes host/port outputs. " +
                $"Diagnostic: ASPIRERADIUS071.");
        }

        ThrowIfNotPrimaryEndpoint(endpointReference, resource, radiusType);

        var scheme = endpointReference.EndpointAnnotation.UriScheme;

View on GitHub (pinned to 25830f84bd)