{"record":{"id":"0d4de39d3d1b07cf","repo":"microsoft/semantic-kernel","slug":"unable-to-deserialize-processevent-queue","errorCode":null,"errorMessage":"Unable to deserialize ProcessEvent queue.","messagePattern":"Unable to deserialize ProcessEvent queue\\.","errorType":"exception","errorClass":"KernelException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Experimental/Process.Runtime.Dapr/Serialization/ProcessEventSerializer.cs","lineNumber":40,"sourceCode":"        EventContainer<ProcessEvent> containedEvent = new(TypeInfo.GetAssemblyQualifiedType(processEvent.Data), processEvent);\n        return JsonSerializer.Serialize(containedEvent);\n    }\n\n    /// <summary>\n    /// Deserialize a list of JSON events into a list of <see cref=\"ProcessEvent\"/> objects.\n    /// </summary>\n    /// <exception cref=\"KernelException\">If any event fails deserialization</exception>\n    public static IList<ProcessEvent> ToProcessEvents(this IEnumerable<string> jsonEvents)\n    {\n        return Deserialize().ToArray();\n\n        IEnumerable<ProcessEvent> Deserialize()\n        {\n            foreach (string json in jsonEvents)\n            {\n                EventContainer<ProcessEvent> eventContainer =\n                    JsonSerializer.Deserialize<EventContainer<ProcessEvent>>(json) ??\n                    throw new KernelException($\"Unable to deserialize {nameof(ProcessEvent)} queue.\");\n                yield return eventContainer.Payload with { Data = TypeInfo.ConvertValue(eventContainer.DataTypeName, eventContainer.Payload.Data) };\n            }\n        }\n    }\n}\n","sourceCodeStart":22,"sourceCodeEnd":46,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Experimental/Process.Runtime.Dapr/Serialization/ProcessEventSerializer.cs#L22-L46","documentation":"Thrown when JSON deserialization of a ProcessEvent entry yields null. Each entry in the event collection is expected to deserialize into an EventContainer<ProcessEvent>; a null result indicates malformed or incompatible JSON.","triggerScenarios":"ProcessEventSerializer.ToProcessEvents iterates a collection of JSON strings and deserializes each; any entry that deserializes to null triggers the exception, aborting the whole batch.","commonSituations":"Corrupted or version-mismatched event payloads persisted in Dapr, partial writes, or entries produced by a producer using a different serialization contract.","solutions":["Inspect each JSON entry in the collection to find the one producing null and verify it matches the EventContainer<ProcessEvent> shape.","Align producer and consumer serialization versions.","Quarantine or remove malformed entries; consider adding tolerant deserialization that skips bad entries instead of aborting.","Validate JSON shape (presence of 'Payload' and 'DataTypeName' fields) before deserializing."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"var valid = jsonEvents.Where(j => !string.IsNullOrWhiteSpace(j) && j.Trim() != \"null\").ToList();\nvar events = valid.ToProcessEvents();","typeGuard":"public static bool IsValidEventJson(string json) =>\n    !string.IsNullOrWhiteSpace(json) && json.TrimStart().StartsWith(\"{\");","tryCatchPattern":"try\n{\n    var events = jsonEvents.ToProcessEvents();\n}\ncatch (KernelException ex) when (ex.Message.Contains(\"Unable to deserialize ProcessEvent queue\"))\n{\n    _logger.LogError(ex, \"One or more event entries are malformed; inspect the batch.\");\n    throw;\n}","preventionTips":["Filter null/literal-null entries before batch deserialization.","Align producer/consumer serialization versions.","Add per-entry try/catch to isolate bad entries."],"tags":["dapr","process-runtime","serialization","json","event-queue"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}