{"record":{"id":"35ac47f5549e5a17","repo":"dotnet/orleans","slug":"the-configured-journal-format-key-must-be-non-empt","errorCode":null,"errorMessage":"The configured journal format key must be non-empty.","messagePattern":"The configured journal format key must be non-empty\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"critical","filePath":"src/Azure/Orleans.Journaling.AzureStorage/AzureBlobJournalStorageProvider.cs","lineNumber":144,"sourceCode":"            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        return journalFormat;\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\n        return journalFormatKey;\n    }\n}\n","sourceCodeStart":126,"sourceCodeEnd":150,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/Azure/Orleans.Journaling.AzureStorage/AzureBlobJournalStorageProvider.cs#L126-L150","documentation":"Thrown by ValidateJournalFormatKey during provider construction when JournaledStateManagerOptions.JournalFormatKey is null, empty, or whitespace. The format key is required to resolve the IJournalFormat service; an empty key cannot be looked up and is rejected before any DI resolution.","triggerScenarios":"Constructing AzureBlobJournalStorageProvider when JournaledStateManagerOptions.JournalFormatKey is unset (null) or whitespace. The check runs at the top of the provider constructor.","commonSituations":"Not configuring JournaledStateManagerOptions at all; clearing the JournalFormatKey during a refactor; reading configuration from a missing section that yields null.","solutions":["Set JournaledStateManagerOptions.JournalFormatKey to a non-empty key that matches a registered IJournalFormat.","Bind the options from configuration and verify the key is present (e.g. appsettings.json 'Journaling:JournalFormatKey': 'json').","Add an IValidateOptions<JournaledStateManagerOptions> that rejects empty format keys at startup."],"exampleFix":"// before\n// JournaledStateManagerOptions.JournalFormatKey never set → null\n\n// after\nservices.Configure<JournaledStateManagerOptions>(o => o.JournalFormatKey = \"json\");","handlingStrategy":"validation","validationCode":"services.AddOptions<JournaledStateManagerOptions>()\n    .Validate(o => !string.IsNullOrWhiteSpace(o.JournalFormatKey), \"JournalFormatKey must be non-empty.\")\n    .ValidateOnStart();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set JournalFormatKey in configuration (e.g. appsettings 'Journaling:JournalFormatKey').","Add ValidateOnStart so an empty key fails the host startup with a clear message.","Pin the key in a constant shared between config and registration."],"tags":["azure-blob-storage","configuration","journal-format","invalid-operation","startup"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}