{"record":{"id":"b29b9b03c5e41452","repo":"dotnet/orleans","slug":"the-journal-id-must-not-be-the-default-value-b29b9b","errorCode":null,"errorMessage":"The journal id must not be the default value.","messagePattern":"The journal id must not be the default value\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Azure/Orleans.Journaling.AzureStorage/AzureTableJournalStorage.cs","lineNumber":84,"sourceCode":"    private readonly string _partitionKey;\n    private TableClient? _tableClient;\n    private ETag _headerETag;\n    private HeaderProviderState _headerProviderState;\n\n    private bool HeaderExists => _headerETag != default;\n\n    public bool IsCompactionRequested\n        => _headerProviderState.AppendRowCount >= _shared.Options.CompactionRowCountThreshold\n            || _headerProviderState.AppendLength >= _shared.Options.CompactionSizeThreshold;\n\n    internal AzureTableJournalStorage(\n        AzureTableJournalStorageShared shared,\n        JournalId journalId)\n    {\n        ArgumentNullException.ThrowIfNull(shared);\n        if (journalId.IsDefault)\n        {\n            throw new ArgumentException(\"The journal id must not be the default value.\", nameof(journalId));\n        }\n\n        _shared = shared;\n        _journalId = journalId;\n        _partitionKey = shared.Options.GetPartitionKeyForJournal(journalId);\n    }\n\n    private TableClient Table => _tableClient ??= GetTableClient();\n\n    public async ValueTask<bool> CreateIfNotExistsAsync(\n        IReadOnlyDictionary<string, string>? metadata = null,\n        CancellationToken cancellationToken = default)\n    {\n        var startTimestamp = Stopwatch.GetTimestamp();\n        var succeeded = false;\n        var callerMetadata = CopyAndValidateCallerMetadata(metadata);\n        try\n        {","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/Azure/Orleans.Journaling.AzureStorage/AzureTableJournalStorage.cs#L66-L102","documentation":"Thrown by AzureTableJournalStorage constructor when the JournalId is default. Each journal maps to one Azure Table partition keyed off the journal id; a default id has no value and cannot produce a partition key. The guard runs before any field assignment.","triggerScenarios":"Constructing AzureTableJournalStorage (directly or via a table-based provider) with default(JournalId). The check is the second statement in the constructor.","commonSituations":"Default-structuring a JournalId; deserializing a JournalId that yields default; passing an uninitialized id from a grain activation path.","solutions":["Construct the JournalId from a non-empty string: new JournalId(\"myJournal\").","Validate journalId.IsDefault before constructing storage.","Initialize JournalId fields at construction time."],"exampleFix":"// before\nvar storage = new AzureTableJournalStorage(shared, default(JournalId));\n\n// after\nvar storage = new AzureTableJournalStorage(shared, new JournalId(\"myJournal\"));","handlingStrategy":"type-guard","validationCode":"if (journalId.IsDefault) throw new InvalidOperationException(\"JournalId not initialized.\");\nvar storage = new AzureTableJournalStorage(shared, journalId);","typeGuard":"static bool IsUsableJournalId(JournalId id) => !id.IsDefault;","tryCatchPattern":null,"preventionTips":["Construct JournalId from a deterministic non-empty string at activation.","Guard construction with journalId.IsDefault.","Avoid default(JournalId) in field initializers."],"tags":["azure-table-storage","journal-id","validation","argument"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}