{"record":{"id":"cf259574b2a14cf2","repo":"dotnet/orleans","slug":"journal-format-key-journalformatkey-requires-k-cf2595","errorCode":null,"errorMessage":"Journal format key '{journalFormatKey}' requires keyed service '{typeof(IJournalFormat).FullName}', but none was registered.","messagePattern":"Journal format key '(.+?)' requires keyed service '(.+?)', but none was registered\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"critical","filePath":"src/Azure/Orleans.Journaling.AzureStorage/AzureTableJournalStorageProvider.cs","lineNumber":130,"sourceCode":"    {\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 void ValidateJournalFormat(IServiceProvider serviceProvider, string journalFormatKey)\n    {\n        var journalFormat = serviceProvider.GetKeyedService<IJournalFormat>(journalFormatKey);\n        if (journalFormat is null)\n        {\n            throw new InvalidOperationException(\n                $\"Journal format key '{journalFormatKey}' requires keyed service '{typeof(IJournalFormat).FullName}', but none was registered.\");\n        }\n\n        if (!string.Equals(journalFormat.FormatKey, journalFormatKey, StringComparison.Ordinal))\n        {\n            throw new InvalidOperationException(\n                $\"Journal format key '{journalFormatKey}' resolved format '{journalFormat.GetType().FullName}', but its {nameof(IJournalFormat.FormatKey)} is '{journalFormat.FormatKey}'. \" +\n                \"Register the journal format using the same key it reports.\");\n        }\n    }\n\n    private static string ValidateJournalFormatKey(string? journalFormatKey)\n    {\n        if (string.IsNullOrWhiteSpace(journalFormatKey))\n        {\n            throw new InvalidOperationException(\"The configured journal format key must be non-empty.\");\n        }\n","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/Azure/Orleans.Journaling.AzureStorage/AzureTableJournalStorageProvider.cs#L112-L148","documentation":"Thrown by ValidateJournalFormat when no keyed service IJournalFormat is registered under the configured journal-format key. The Azure Table journal provider delegates serialization to a pluggable IJournalFormat resolved by key from DI; a missing registration means there is no format to read or write journals.","triggerScenarios":"JournaledStateManagerOptions.JournalFormatKey is set (e.g. 'json') but the corresponding AddJournalFormat<JsonJournalFormat>('json', ...) call was never made, so serviceProvider.GetKeyedService<IJournalFormat>(key) returns null during provider construction.","commonSituations":"Upgrading or removing a journal-format package without re-registering it; a typo between the registered key and the configured JournalFormatKey; conditional registration that did not execute in the current environment.","solutions":["Register the IJournalFormat keyed service with the exact key, e.g. services.AddKeyedSingleton<IJournalFormat, JsonJournalFormat>('json').","Match JournaledStateManagerOptions.JournalFormatKey to the key used at registration.","Ensure the journal-format package (e.g. Orleans.Journaling.Json) is referenced and its Add* extension is called."],"exampleFix":"// before\nservices.Configure<JournaledStateManagerOptions>(o => o.JournalFormatKey = 'json');\n// (no IJournalFormat registration)\n// after\nservices.AddJournalFormat<JsonJournalFormat>('json');\nservices.Configure<JournaledStateManagerOptions>(o => o.JournalFormatKey = 'json');","handlingStrategy":"validation","validationCode":"var fmt = serviceProvider.GetKeyedService<IJournalFormat>(journalFormatKey);\nif (fmt is null) throw new InvalidOperationException($\"Register IJournalFormat for key '{journalFormatKey}'.\");","typeGuard":"static bool IsJournalFormatRegistered(IServiceProvider sp, string key) => sp.GetKeyedService<IJournalFormat>(key) is not null;","tryCatchPattern":null,"preventionTips":["Register the IJournalFormat keyed service with the same key you set as JournalFormatKey.","Use the journaling Add* extension that pairs registration with the key.","Add a startup DI validation pass that walks required keyed services."],"tags":["azure-table-storage","journaling","dependency-injection","configuration","journal-format","startup"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}