{"record":{"id":"7507cb569f2435b4","repo":"microsoft/aspire","slug":"aspireradius072","errorCode":"ASPIRERADIUS072","errorMessage":"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.","messagePattern":"Resource '(.+?)' has a Radius recipe that provisions the single database '(.+?)', but '(.+?)' (.+?) also consumed by the application, so those consumers would receive a connection string naming a database the deployment will not contain\\. Consume only '(.+?)', or declare one database per resource\\. Diagnostic: ASPIRERADIUS072\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.Radius/Publishing/RadiusInfrastructureBuilder.cs","lineNumber":2375,"sourceCode":"        foreach (var (resource, selectedDatabaseName) in _recipeDatabaseSelections)\n        {\n            // Union of both signals, because either one on its own is incomplete: annotations miss a\n            // callback-only consumer, and the resolved-consumption set misses a database that is\n            // referenced but whose value no container happened to resolve.\n            var wronglyConsumed = FindDatabaseChildren(resource)\n                .Where(d => !string.Equals(GetPhysicalDatabaseName(d), selectedDatabaseName, StringComparison.Ordinal))\n                .Where(d => referencedResourceNames.Contains(d.Name) ||\n                            _resolvedConnectionStringConsumption.Contains(d.Name))\n                .Select(GetPhysicalDatabaseName)\n                .Distinct(StringComparer.Ordinal)\n                .ToList();\n\n            if (wronglyConsumed.Count == 0)\n            {\n                continue;\n            }\n\n            throw new InvalidOperationException(\n                $\"Resource '{resource.Name}' has a Radius recipe that provisions the single database \" +\n                $\"'{selectedDatabaseName}', but '{string.Join(\"', '\", wronglyConsumed)}' \" +\n                $\"{(wronglyConsumed.Count == 1 ? \"is\" : \"are\")} also consumed by the application, so those consumers \" +\n                $\"would receive a connection string naming a database the deployment will not contain. Consume only \" +\n                $\"'{selectedDatabaseName}', or declare one database per resource. Diagnostic: ASPIRERADIUS072.\");\n        }\n    }\n\n    /// <summary>\n    /// Wires a type whose recipe generates its own credentials and exposes them through\n    /// <c>listSecrets()</c>: Aspire's parameters are substituted for the recipe's own values\n    /// wherever they appear, so every composed value carries what is actually deployed.\n    /// </summary>\n    private void ApplyListSecretsCredentials(\n        IResource resource,\n        IResourceWithConnectionString withConnectionString,\n        RadiusResourceTypeConstruct construct,\n        RadiusBackingConnections.RadiusConnectionSchema schema,","sourceCodeStart":2357,"sourceCodeEnd":2393,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Radius/Publishing/RadiusInfrastructureBuilder.cs#L2357-L2393","documentation":"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.","triggerScenarios":"Publishing a resource whose recipe provisions exactly one named database (selectedDatabaseName) while the application model consumes other database names (wronglyConsumed) on the same resource.","commonSituations":"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.","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."],"exampleFix":"// before\nvar db1 = builder.AddPostgres(\"pg\").AddDatabase(\"orders\");\nvar db2 = builder.AddPostgres(\"pg\").AddDatabase(\"billing\");\n// after\nvar orders = builder.AddPostgres(\"pg\").AddDatabase(\"orders\");\nvar billing = builder.AddPostgres(\"pg-billing\").AddDatabase(\"billing\");","handlingStrategy":"validation","validationCode":"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.\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["radius","publish","database","recipes"],"backgroundTag":"invalid-argument-value","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"}