{"record":{"id":"405fec7f6ca69468","repo":"microsoft/aspire","slug":"aspireradius068","errorCode":"ASPIRERADIUS068","errorMessage":"Application-scoped Radius secret store(s) '{string.Join(\"', '\", orphaned)}' were declared but the model contains no Radius environment. Application-scoped stores are emitted and deployed by a Radius environment; add one with AddRadiusEnvironment. Diagnostic: ASPIRERADIUS068.","messagePattern":"Application-scoped Radius secret store\\(s\\) '(.+?)' were declared but the model contains no Radius environment\\. Application-scoped stores are emitted and deployed by a Radius environment; add one with AddRadiusEnvironment\\. Diagnostic: ASPIRERADIUS068\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.Radius/Secrets/RadiusSecretStoreValidation.cs","lineNumber":81,"sourceCode":"    /// </summary>\n    internal static void ValidateHasEnvironment(DistributedApplicationModel model)\n    {\n        ArgumentNullException.ThrowIfNull(model);\n\n        if (model.Resources.OfType<RadiusEnvironmentResource>().Any())\n        {\n            return;\n        }\n\n        var orphaned = model.Resources\n            .OfType<RadiusSecretStoreResource>()\n            .Where(static s => s.Scope == RadiusSecretStoreScope.Application)\n            .Select(static s => s.Name)\n            .ToList();\n\n        if (orphaned.Count > 0)\n        {\n            throw new InvalidOperationException(\n                $\"Application-scoped Radius secret store(s) '{string.Join(\"', '\", orphaned)}' were declared \" +\n                \"but the model contains no Radius environment. Application-scoped stores are emitted and \" +\n                \"deployed by a Radius environment; add one with AddRadiusEnvironment. Diagnostic: ASPIRERADIUS068.\");\n        }\n    }\n\n    /// <summary>\n    /// Validates every declared secret store over the whole application model.\n    /// </summary>\n    /// <exception cref=\"InvalidOperationException\">\n    /// A required key is missing (<c>ASPIRERADIUS040</c>), the population mode count is not\n    /// exactly one (<c>ASPIRERADIUS041</c>), an inline key binds a non-secret parameter\n    /// (<c>ASPIRERADIUS042</c>), a duplicate key is declared (<c>ASPIRERADIUS043</c>), an\n    /// invalid encoding is set for the type (<c>ASPIRERADIUS047</c>), two stores share a\n    /// Bicep identifier within the same emitted scope (<c>ASPIRERADIUS048</c>), an\n    /// application-scoped existing store uses a namespace-less reference (<c>ASPIRERADIUS055</c>),\n    /// or a non-sealed store sets <c>WithMaterializationTimeout</c> (<c>ASPIRERADIUS062</c>).\n    /// </exception>","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Radius/Secrets/RadiusSecretStoreValidation.cs#L63-L99","documentation":"Validation of the application model (ASPIRERADIUS068) fails when application-scoped Radius secret stores exist but no Radius environment was added to the model. Application-scoped stores are emitted and deployed by a Radius environment, so without one they cannot be materialized. ValidateHasEnvironment collects application-scoped store names and throws listing them.","triggerScenarios":"Calling AddRadiusSecretStore with Application scope in an AppHost model that never calls AddRadiusEnvironment; the environment resource was removed or is conditionally skipped.","commonSituations":"Following a secret-store sample without copying its AddRadiusEnvironment line; refactoring where the environment registration was deleted; feature flags that skip environment setup.","solutions":["Add a Radius environment to the model, e.g. builder.AddRadiusEnvironment(\"env\", ...).","Remove or delay the application-scoped secret store if no Radius environment is intended.","Ensure any conditional logic guarding AddRadiusEnvironment actually runs."],"exampleFix":"// before\nbuilder.AddRadiusSecretStore(\"store\", scope: RadiusSecretStoreScope.Application);\n// after\nbuilder.AddRadiusEnvironment(\"env\", ...);\nbuilder.AddRadiusSecretStore(\"store\", scope: RadiusSecretStoreScope.Application);","handlingStrategy":"validation","validationCode":"if (usesApplicationScopedSecretStores && !model.Resources.OfType<RadiusEnvironmentResource>().Any())\n    throw new InvalidOperationException(\"Add builder.AddRadiusEnvironment(...) before application-scoped secret stores.\");","typeGuard":null,"tryCatchPattern":"try { /* build/publish model */ }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"ASPIRERADIUS068\")) { /* add the environment or drop the stores */ }","preventionTips":["Register AddRadiusEnvironment before any AddRadiusSecretStore calls in the AppHost","Check conditional flags that could skip environment registration","Run app-model validation in tests to catch missing environment early"],"tags":["validation","radius","missing-dependency"],"backgroundTag":"missing-dependency","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T09:17:21.228Z"}