You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
.NET: [Bug]: AGUI client crashes on non-JSON TOOL_CALL_RESULT content from handoff with JsonException ('T' is an invalid start of a value) #5587
I’m seeing a crash in AGUI streaming when a workflow handoff emits a TOOL_CALL_RESULT with plain text content.
Environment
Microsoft Agent Framework (latest main as of 2026-04-30)
AGUI client via AGUIChatClient
Workflow built with handoff builder and exposed via AGUI endpoint
Repro
Build workflow with handoff orchestration.
Consume endpoint with AGUIChatClient.
Call RunStreamingAsync.
Observe AGUI SSE events:
RUN_STARTED
TOOL_CALL_START (handoff_to_1)
TOOL_CALL_ARGS
TOOL_CALL_END
TOOL_CALL_RESULT with content: Transferred.
Actual
Client throws:
System.Text.Json.JsonException: 'T' is an invalid start of a value
at ChatResponseUpdateAGUIExtensions.DeserializeResultIfAvailable(ToolCallResultEvent ...)
Expected
Non-JSON tool result content should not crash deserialization.
Either:
treat content as raw string result, or
deserialize as JsonElement only when content is valid JSON.
Root cause candidate
In ChatResponseUpdateAGUIExtensions:
SerializeResultContent returns raw string for FunctionResultContent strings.
DeserializeResultIfAvailable always attempts JsonSerializer.Deserialize(... JsonElement ...) for non-empty content.
This fails for plain text like Transferred.
Suggested fix
Fallback to raw string when JsonElement deserialization fails.
This issue is resolved by the current AGUI.Client implementation.
The former converter serialized string tool results as plain text but then unconditionally attempted to deserialize that text as a JsonElement. Values such as "Transferred." or "Success: Function completed." therefore failed at their first non-JSON character.
The current SDK passes ToolCallResultEvent.Content directly into FunctionResultContent:
We exercised plain text, JSON-looking text, empty text, and null results. Plain-text results were returned as strings without exceptions in repeated runs. JSON-looking results are also preserved as strings; consumers that require a JSON DOM should parse them explicitly.
Applications should use AGUI.Client instead of the removed Microsoft.Agents.AI.AGUI package. Since the failing conversion path has been replaced and the reported scenario now succeeds, this issue can be closed as resolved.
Activity
awaescher commentedon May 4, 2026
Seems to be related:
This missing function exception ...
... gets hidden by this follow up exception:
max-meng1 commentedon May 20, 2026
Same issue, there is an extra message TOOL_CALL_RESULT after TOOL_CALL_END, after upgrade the package.
javiercn commentedon Aug 18, 2026
This issue is resolved by the current
AGUI.Clientimplementation.The former converter serialized string tool results as plain text but then unconditionally attempted to deserialize that text as a
JsonElement. Values such as"Transferred."or"Success: Function completed."therefore failed at their first non-JSON character.The current SDK passes
ToolCallResultEvent.Contentdirectly intoFunctionResultContent:We exercised plain text, JSON-looking text, empty text, and null results. Plain-text results were returned as strings without exceptions in repeated runs. JSON-looking results are also preserved as strings; consumers that require a JSON DOM should parse them explicitly.
Applications should use
AGUI.Clientinstead of the removedMicrosoft.Agents.AI.AGUIpackage. Since the failing conversion path has been replaced and the reported scenario now succeeds, this issue can be closed as resolved.