{"record":{"id":"35586b1bc4f5514f","repo":"microsoft/autogen","slug":"orleans-cosmosdbconnectionstring-is-missing-from-c","errorCode":null,"errorMessage":"Orleans:CosmosDBConnectionString is missing from configuration. This is required for persistence in production environments.","messagePattern":"Orleans:CosmosDBConnectionString is missing from configuration\\. This is required for persistence in production environments\\.","errorType":"exception","errorClass":"ConfigurationErrorsException","httpStatus":null,"severity":"critical","filePath":"dotnet/src/Microsoft.AutoGen/RuntimeGateway.Grpc/Services/Orleans/OrleansRuntimeHostingExtenions.cs","lineNumber":41,"sourceCode":"        {\n            // Development mode or local mode uses in-memory storage and streams\n            if (builder.Environment.IsDevelopment())\n            {\n                siloBuilder.UseLocalhostClustering()\n                       .AddMemoryStreams(\"StreamProvider\")\n                       .AddMemoryGrainStorage(\"PubSubStore\")\n                       .AddMemoryGrainStorage(\"AgentRegistryStore\")\n                       .AddMemoryGrainStorage(\"AgentStateStore\");\n\n                siloBuilder.UseInMemoryReminderService();\n                siloBuilder.UseDashboard(x => x.HostSelf = true);\n\n                siloBuilder.UseInMemoryReminderService();\n            }\n            else\n            {\n                var cosmosDbconnectionString = builder.Configuration.GetValue<string>(\"Orleans:CosmosDBConnectionString\") ??\n                    throw new ConfigurationErrorsException(\n                        \"Orleans:CosmosDBConnectionString is missing from configuration. This is required for persistence in production environments.\");\n\n                siloBuilder.Configure<SiloMessagingOptions>(options =>\n                {\n                    options.ResponseTimeout = TimeSpan.FromMinutes(3);\n                    options.SystemResponseTimeout = TimeSpan.FromMinutes(3);\n                });\n                siloBuilder.Configure<ClientMessagingOptions>(options =>\n                {\n                    options.ResponseTimeout = TimeSpan.FromMinutes(3);\n                });\n                siloBuilder.UseCosmosClustering(o =>\n                {\n                    o.ConfigureCosmosClient(cosmosDbconnectionString);\n                    o.ContainerName = \"AutoGen\";\n                    o.DatabaseName = \"clustering\";\n                    o.IsResourceCreationEnabled = true;\n                });","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/dotnet/src/Microsoft.AutoGen/RuntimeGateway.Grpc/Services/Orleans/OrleansRuntimeHostingExtenions.cs#L23-L59","documentation":"ConfigurationErrorsException thrown by the Orleans runtime hosting extension when the environment is not development and 'Orleans:CosmosDBConnectionString' is absent from configuration. In production mode the silo is configured with Cosmos DB clustering/persistence, which is impossible without the connection string, so startup aborts.","triggerScenarios":"Running the Grpc runtime gateway with ASPNETCORE_ENVIRONMENT set to Production (anything other than the development branch) while the Orleans:CosmosDBConnectionString configuration key is missing from appsettings, environment variables, user secrets, or KeyVault.","commonSituations":"Deploying to a container or Azure App Service where the environment flips to Production but secrets were only in local user-secrets; a typo in the key (e.g. 'Orleans:CosmosDbConnectionString'); KeyVault configuration provider not registered in the production host; CI smoke tests that set Production without secrets.","solutions":["Provide the key exactly as 'Orleans:CosmosDBConnectionString' in the production configuration source (appsettings.Production.json, environment variable Orleans__CosmosDBConnectionString, or KeyVault).","Verify with a startup log or config dump (never log the value) that the key resolves before the silo builder runs.","For local non-development testing, either set the connection string or keep the environment as Development to get the in-memory stores."],"exampleFix":"# before\nexport ASPNETCORE_ENVIRONMENT=Production\n# Orleans:CosmosDBConnectionString unset -> startup throws\n\n# after\nexport ASPNETCORE_ENVIRONMENT=Production\nexport Orleans__CosmosDBConnectionString=\"AccountEndpoint=...;AccountKey=...;\"","handlingStrategy":"validation","validationCode":"var connectionString = builder.Configuration.GetValue<string>(\"Orleans:CosmosDBConnectionString\");\nif (!builder.Environment.IsDevelopment() && string.IsNullOrWhiteSpace(connectionString))\n{\n    throw new InvalidOperationException(\n        \"Refusing to start in production without Orleans:CosmosDBConnectionString. Set Orleans__CosmosDBConnectionString or configure KeyVault.\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set Orleans__CosmosDBConnectionString as an environment variable in every non-development deployment.","Wire a KeyVault configuration provider in Program.cs before the Orleans hosting extension runs.","Add a deployment smoke test that boots the gateway in Production mode with secrets from the same source as real deploys."],"tags":["dotnet","orleans","configuration","deployment","secrets"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}