{"record":{"id":"b81c4559fc93b3a9","repo":"dotnet/orleans","slug":"azureblobjournalstorageprovider-has-not-been-initi","errorCode":null,"errorMessage":"AzureBlobJournalStorageProvider has not been initialized. Ensure the silo lifecycle has started before using journal storage.","messagePattern":"AzureBlobJournalStorageProvider has not been initialized\\. Ensure the silo lifecycle has started before using journal storage\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Azure/Orleans.Journaling.AzureStorage/AzureBlobJournalStorageProvider.cs","lineNumber":104,"sourceCode":"        }\n\n        foreach (var journalId in journalIds.OrderBy(static journalId => journalId.Value, StringComparer.Ordinal))\n        {\n            cancellationToken.ThrowIfCancellationRequested();\n            yield return journalId;\n        }\n    }\n\n    public void Participate(ISiloLifecycle observer)\n    {\n        observer.Subscribe(\n            nameof(AzureBlobJournalStorageProvider),\n            ServiceLifecycleStage.RuntimeInitialize,\n            onStart: Initialize);\n    }\n\n    private BlobContainerClient GetDefaultContainerClient()\n        => _defaultContainer ?? throw new InvalidOperationException(\n            $\"{nameof(AzureBlobJournalStorageProvider)} has not been initialized. Ensure the silo lifecycle has started before using journal storage.\");\n\n    private static bool TryParseJournalId(string value, out JournalId journalId)\n    {\n        try\n        {\n            journalId = new JournalId(value);\n            return true;\n        }\n        catch (ArgumentException)\n        {\n            journalId = default;\n            return false;\n        }\n    }\n\n    private static IJournalFormat GetJournalFormat(IServiceProvider serviceProvider, string journalFormatKey)\n    {","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/Azure/Orleans.Journaling.AzureStorage/AzureBlobJournalStorageProvider.cs#L86-L122","documentation":"Thrown by AzureBlobJournalStorageProvider.GetDefaultContainerClient when the default container client is null, meaning the provider has not run its lifecycle initialization. The provider subscribes to the silo lifecycle at RuntimeInitialize stage and creates the container there; calling ListAsync or other methods before that stage completes yields this error.","triggerScenarios":"Invoking provider.ListAsync(...) (or any path through GetDefaultContainerClient) before the silo lifecycle has reached RuntimeInitialize and run the Initialize callback. Commonly happens in tests, startup hooks, or grain constructors that run before the silo is fully started.","commonSituations":"Unit/integration tests that construct the provider directly without driving the lifecycle; calling ListAsync from a grain's OnActivateAsync before the hosting stage completes; ordering misconfiguration where journal storage is used before RuntimeInitialize.","solutions":["Ensure the silo is fully started before calling ListAsync; in tests, use a test hosting harness that drives the lifecycle.","Delay listing journals until after the RuntimeInitialize lifecycle stage.","If you need listing outside the silo, construct a standalone BlobContainerClient and query the container directly."],"exampleFix":"// before (in a test)\nvar provider = new AzureBlobJournalStorageProvider(...);\nawait foreach (var id in provider.ListAsync()) { ... } // throws: not initialized\n\n// after\nawait provider.Participate(...); // or use a TestHost that runs lifecycle stages\nawait foreach (var id in provider.ListAsync()) { ... }","handlingStrategy":"validation","validationCode":"// In a test harness, drive the lifecycle before calling ListAsync:\nvar lifecycle = new TestSiloLifecycle();\nprovider.Participate(lifecycle);\nawait lifecycle.OnStart(RuntimeInitializeStage);\nawait foreach (var id in provider.ListAsync()) { ... }","typeGuard":null,"tryCatchPattern":"try { await foreach (var id in provider.ListAsync(ct)) { ... } }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"has not been initialized\"))\n{\n    logger.LogWarning(\"Journal storage queried before silo RuntimeInitialize; deferring.\");\n}","preventionTips":["Use a test host that drives the silo lifecycle in unit/integration tests.","Delay journal enumeration until after the hosting stage completes.","Guard entry points that call GetDefaultContainerClient with a lifecycle-started flag."],"tags":["azure-blob-storage","lifecycle","initialization","invalid-operation"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}