{"record":{"id":"fc11d813909ae58a","repo":"microsoft/semantic-kernel","slug":"unable-to-deserialize-processmessage-queue","errorCode":null,"errorMessage":"Unable to deserialize ProcessMessage queue.","messagePattern":"Unable to deserialize ProcessMessage queue\\.","errorType":"exception","errorClass":"KernelException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Experimental/Process.Runtime.Dapr/Serialization/ProcessMessageSerializer.cs","lineNumber":41,"sourceCode":"        MessageContainer containedMessage = new(TypeInfo.GetAssemblyQualifiedType(processMessage.TargetEventData), typeMap, processMessage);\n        return JsonSerializer.Serialize(containedMessage);\n    }\n\n    /// <summary>\n    /// Deserialize a list of JSON messages into a list of <see cref=\"ProcessMessage\"/> objects.\n    /// </summary>\n    /// <exception cref=\"KernelException\">If any message fails deserialization</exception>\n    public static IList<ProcessMessage> ToProcessMessages(this IEnumerable<string> jsonMessages)\n    {\n        return Deserialize().ToArray();\n\n        IEnumerable<ProcessMessage> Deserialize()\n        {\n            foreach (string json in jsonMessages)\n            {\n                MessageContainer containedMessage =\n                    JsonSerializer.Deserialize<MessageContainer>(json) ??\n                    throw new KernelException($\"Unable to deserialize {nameof(ProcessMessage)} queue.\");\n\n                yield return Process(containedMessage);\n            }\n        }\n    }\n\n    private static ProcessMessage Process(MessageContainer messageContainer)\n    {\n        ProcessMessage processMessage = messageContainer.Message;\n\n        if (processMessage.Values.Count == 0)\n        {\n            return processMessage;\n        }\n\n        processMessage =\n            processMessage with\n            {","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Experimental/Process.Runtime.Dapr/Serialization/ProcessMessageSerializer.cs#L23-L59","documentation":"Thrown when JSON deserialization of a ProcessMessage container yields null. Messages are wrapped in a MessageContainer; a null result means the JSON could not be deserialized into that shape.","triggerScenarios":"ProcessMessageSerializer.ToProcessMessages iterates JSON strings and deserializes each into MessageContainer; a null result for any entry raises this exception before processing the message.","commonSituations":"Corrupted message entries in the Dapr message buffer, schema/version drift in ProcessMessage, or a payload written by a different serializer.","solutions":["Examine the failing JSON entry to confirm it has the expected MessageContainer shape with a valid Message field.","Ensure producers and consumers share the same ProcessMessage serialization version.","Purge corrupted entries or implement tolerant handling that logs and skips bad messages.","Pre-validate that each JSON string is a non-null object before deserialization."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"var valid = jsonMessages.Where(j => !string.IsNullOrWhiteSpace(j) && j.Trim() != \"null\").ToList();\nvar messages = valid.ToProcessMessages();","typeGuard":"public static bool IsValidMessageJson(string json) =>\n    !string.IsNullOrWhiteSpace(json) && json.TrimStart().StartsWith(\"{\");","tryCatchPattern":"try\n{\n    var messages = jsonMessages.ToProcessMessages();\n}\ncatch (KernelException ex) when (ex.Message.Contains(\"Unable to deserialize ProcessMessage queue\"))\n{\n    _logger.LogError(ex, \"Malformed message JSON in batch.\");\n    throw;\n}","preventionTips":["Validate each JSON entry is a non-null object before deserialization.","Keep producer and consumer serialization contracts in sync.","Isolate and dead-letter corrupted message entries."],"tags":["dapr","process-runtime","serialization","json","message-buffer"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}