{"record":{"id":"6844c53ec760f1b4","repo":"dotnet/orleans","slug":"azure-table-journal-header-metadata-property-is-in","errorCode":null,"errorMessage":"Azure Table journal header metadata property is invalid.","messagePattern":"Azure Table journal header metadata property is invalid\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Azure/Orleans.Journaling.AzureStorage/AzureTableJournalStorage.cs","lineNumber":1083,"sourceCode":"\n    private static string SerializeCallerMetadata(IReadOnlyDictionary<string, string>? metadata)\n        => metadata is { Count: > 0 } ? JsonSerializer.Serialize(metadata) : \"{}\";\n\n    private static Dictionary<string, string> DeserializeCallerMetadata(string? json)\n    {\n        if (json is not { Length: > 0 })\n        {\n            return new Dictionary<string, string>(StringComparer.Ordinal);\n        }\n\n        Dictionary<string, string>? parsed;\n        try\n        {\n            parsed = JsonSerializer.Deserialize<Dictionary<string, string>>(json);\n        }\n        catch (JsonException exception)\n        {\n            throw new InvalidOperationException(\"Azure Table journal header metadata property is invalid.\", exception);\n        }\n\n        var result = new Dictionary<string, string>(StringComparer.Ordinal);\n        if (parsed is not null)\n        {\n            foreach (var (key, value) in parsed)\n            {\n                result[key] = value;\n            }\n        }\n\n        return result;\n    }\n\n    private static Dictionary<string, string> CopyAndValidateCallerMetadata(IReadOnlyDictionary<string, string>? metadata)\n    {\n        var result = new Dictionary<string, string>(StringComparer.Ordinal);\n        if (metadata is null)","sourceCodeStart":1065,"sourceCodeEnd":1101,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/Azure/Orleans.Journaling.AzureStorage/AzureTableJournalStorage.cs#L1065-L1101","documentation":"The header row's Metadata property is not valid JSON for a Dictionary<string,string>. DeserializeCallerMetadata (AzureTableJournalStorage.cs:1069) parses the Metadata column with System.Text.Json; on JsonException it wraps the error in this InvalidOperationException. The provider always writes well-formed JSON (SerializeCallerMetadata at line 1066), so malformed JSON indicates corruption or an incompatible writer.","triggerScenarios":"entity.GetString(MetadataPropertyName) returns a non-JSON or wrong-shaped string; JsonSerializer.Deserialize<Dictionary<string,string>> throws JsonException; wrapped and rethrown at AzureTableJournalStorage.cs:1083.","commonSituations":"An external editor typed a free-text value into the Metadata column; a non-provider writer stored a JSON object with non-string values; truncation cut the JSON mid-payload; an older schema stored a different Metadata format.","solutions":["Reset the Metadata column to \"{}\" (the empty-dictionary serialization) or delete the header so it is regenerated.","Ensure only the provider writes the Metadata property.","If migrating metadata, serialize with JsonSerializer.Serialize(Dictionary<string,string>) before writing."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { /* read header */ }\ncatch (InvalidOperationException ex) when (ex.InnerException is System.Text.Json.JsonException)\n{\n    // Metadata column is corrupt; reset to \"{}\" or Replace the header.\n}","preventionTips":["Only the provider writes the Metadata column.","When migrating, serialize metadata with JsonSerializer.Serialize(Dictionary<string,string>).","Avoid manual edits to JSON columns."],"tags":["azure-table","data-corruption","journal","metadata","json"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}