{"record":{"id":"8918aff14cca624f","repo":"microsoft/aspire","slug":"aspireradius069","errorCode":"ASPIRERADIUS069","errorMessage":"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.","messagePattern":"Resource '(.+?)' is deployed by a Radius recipe in a different environment than '(.+?)', so its address cannot be resolved here\\. Deploy the consumer and '(.+?)' to the same Radius environment\\. Diagnostic: ASPIRERADIUS069\\.","errorType":"validation","errorClass":"RadiusBackingResourceProjectionException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.Radius/Publishing/RadiusInfrastructureBuilder.cs","lineNumber":3365,"sourceCode":"    private bool TryProjectBackingEndpoint(\n        EndpointReference endpointReference,\n        EndpointProperty property,\n        List<EnvPart> parts)\n    {\n        var resource = ResolveToParent(endpointReference.Resource);\n\n        if (!ResourceTypeMapper.IsBackingResource(resource))\n        {\n            return false;\n        }\n\n        if (!_typeInstancesByResourceName.TryGetValue(resource.Name, out var construct) ||\n            !_radiusTypeByResourceName.TryGetValue(resource.Name, out var radiusType))\n        {\n            // The resource is a backing resource but this environment did not emit it — it belongs\n            // to a different Radius environment. There is no construct to project from, and the\n            // recipe outputs of another environment's deployment are not reachable from this Bicep.\n            throw new RadiusBackingResourceProjectionException(\n                resource,\n                $\"Resource '{resource.Name}' is deployed by a Radius recipe in a different environment than '{_environment.Name}', \" +\n                $\"so its address cannot be resolved here. Deploy the consumer and '{resource.Name}' to the same Radius environment. \" +\n                $\"Diagnostic: ASPIRERADIUS069.\");\n        }\n\n        if (RadiusBackingConnections.GetSchema(radiusType) is not { } schema)\n        {\n            throw new RadiusBackingResourceProjectionException(\n                resource,\n                $\"Resource '{resource.Name}' maps to Radius type '{radiusType}', which does not expose an address Aspire can \" +\n                $\"project. Remove the reference, or map the resource to a Radius type that publishes host/port outputs. \" +\n                $\"Diagnostic: ASPIRERADIUS071.\");\n        }\n\n        ThrowIfNotPrimaryEndpoint(endpointReference, resource, radiusType);\n\n        var scheme = endpointReference.EndpointAnnotation.UriScheme;","sourceCodeStart":3347,"sourceCodeEnd":3383,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Radius/Publishing/RadiusInfrastructureBuilder.cs#L3347-L3383","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Deploy the consumer and the referenced resource into the same Radius environment.","Move the backing resource's definition into the same AppHost/environment as its consumer.","If the resource must stay elsewhere, provision the connection manually (explicit connection string/env var) instead of referencing the recipe-backed resource."],"exampleFix":"// before: consumer in envA references database emitted by envB recipe\nvar db = builder.AddPostgres(\"db\");\n// after: define the database alongside the consumer so both publish to the same Radius environment\nvar db = builder.AddPostgres(\"db\");\nvar api = builder.AddProject<Projects.Api>(\"api\").WithReference(db).WaitFor(db);","handlingStrategy":"validation","validationCode":"// Before publish, verify referenced backing resources are emitted in the current environment\nforeach (var r in appModel.Resources.Where(r => r is IResourceWithWaitSupport || references contain them))\n{\n    if (!emittedResourceNames.Contains(r.Name))\n        throw new InvalidOperationException($\"'{r.Name}' is not part of the published Radius environment; move it in or drop the reference.\");\n}","typeGuard":null,"tryCatchPattern":"catch (RadiusBackingResourceProjectionException ex) when (ex.Message.Contains(\"ASPIRERADIUS069\"))\n{\n    logger.LogError(ex, \"Cross-environment reference detected\");\n}","preventionTips":["Keep consumers and the backing resources they reference in the same AppHost/Radius environment.","Review publish manifests for resources filtered out of the current environment before referencing them.","Avoid referencing shared resources owned by other AppHosts across environments."],"tags":["radius","publish","cross-environment","resource-reference"],"backgroundTag":"resource-not-found","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}