microsoft/aspire · error · InvalidOperationException
ASPIRERADIUS048
ASPIRERADIUS048
Error message
Secret stores '{existing.Name}' and '{store.Name}' map to the same Bicep identifier '{identifier}' within the same emitted scope. Rename one so they produce distinct identifiers. Diagnostic: ASPIRERADIUS048. What it means
Thrown for ASPIRERADIUS048 when two secret stores would emit the same Bicep identifier within the same emitted scope, which would produce an invalid/colliding Bicep declaration. Note this is based on the derived Bicep identifier, not necessarily the raw resource name, so distinct C# names can still collide after identifier normalization. The validator (ValidateNoDuplicateNames) detects the collision and reports both store names plus the offending identifier.
Solutions
- Rename one of the two stores so their derived Bicep identifiers differ.
- If names come from generated/config data, add a distinguishing prefix or suffix before registration.
- Check for duplicate registration of the same logical store (accidental double Add).
Example fix
// before
radius.AddSecretStore("my-store", ...);
radius.AddSecretStore("My_Store", ...); // same Bicep identifier
// after
radius.AddSecretStore("my-store", ...);
radius.AddSecretStore("my-store-2", ...); Defensive patterns
Strategy: try-catch
Validate before calling
// Normalize names the same way Bicep identifiers are derived and assert uniqueness before adding stores.
var ids = stores.Select(NormalizeToBicepIdentifier);
if (ids.Distinct(StringComparer.Ordinal).Count() != ids.Count()) throw new InvalidOperationException("Duplicate Bicep identifiers"); Try / catch
try { ValidateSecretStore(store); } catch (InvalidOperationException ex) when (ex.Message.Contains("ASPIRERADIUS048")) { /* rename the colliding store and retry */ } Prevention
- Generate store names with globally distinguishing prefixes.
- Remember Bicep identifier normalization strips/replaces characters like '-' and '_', and is case-sensitive.
- Avoid programmatic loops that add stores from config without uniqueness assertions.
When it happens
Trigger: Adding two RadiusSecretStoreResources whose names normalize to the same Bicep identifier (e.g. 'My_Store' and 'my-store', or names differing only by characters stripped during identifier sanitization) inside the same scope; re-adding a store with a name that collides with an existing one.
Common situations: Loops that add stores with generated names that collide after sanitization; case-insensitive duplicates; renaming conventions where '-' and '_' normalize away; copy-pasting a store registration twice with a minor name tweak that still normalizes identically.
Understand the failure class
Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.
Related errors
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/c830f975c19d4c1f.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Hosting.Radius/Secrets/RadiusSecretStoreValidation.cs:392
{
ThrowDuplicateName(sameEnvironmentCollision, store, identifier);
}
if (appScoped.TryGetValue(identifier, out var applicationCollision))
{
ThrowDuplicateName(applicationCollision, store, identifier);
}
envScoped[envKey] = store;
}
}
private static void ThrowDuplicateName(
RadiusSecretStoreResource existing,
RadiusSecretStoreResource store,
string identifier)
{
throw new InvalidOperationException(
$"Secret stores '{existing.Name}' and '{store.Name}' map to the same Bicep identifier " +
$"'{identifier}' within the same emitted scope. Rename one so they produce distinct identifiers. " +
"Diagnostic: ASPIRERADIUS048.");
}
}
View on GitHub (pinned to 25830f84bd)