Repository navigation
Closed
Labels
.NETUsage: [Issues, PRs], Target: .NetUsage: [Issues, PRs], Target: .Netag-uiUsage: [Issues, PRs], Target: AG-UI protocol integrationUsage: [Issues, PRs], Target: AG-UI protocol integrationbugUsage: [Issues], Target: all issues (Legacy, prefer issue type: bug)Usage: [Issues], Target: all issues (Legacy, prefer issue type: bug)reproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflowUsage: [Issues], Target: all issues that can be reproduced by the triage workflow
Description
Description
if we sending approval response as false, getting error "System.Text.Json.JsonException: ''T' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.'" in AGUI Client
Code Sample
Error Messages / Stack Traces
System.Text.Json.JsonException
HResult=0x80131500
Message='T' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.
Source=System.Text.Json
StackTrace:
at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex)
at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, T& value, JsonSerializerOptions options, ReadStack& state)
at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.Deserialize(Utf8JsonReader& reader, ReadStack& state)
at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.DeserializeAsObject(Utf8JsonReader& reader, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadFromSpanAsObject(ReadOnlySpan`1 utf8Json, JsonTypeInfo jsonTypeInfo, Nullable`1 actualByteCount)
at System.Text.Json.JsonSerializer.ReadFromSpanAsObject(ReadOnlySpan`1 json, JsonTypeInfo jsonTypeInfo)
at System.Text.Json.JsonSerializer.Deserialize(String json, JsonTypeInfo jsonTypeInfo)
at Microsoft.Agents.AI.AGUI.Shared.ChatResponseUpdateAGUIExtensions.DeserializeResultIfAvailable(ToolCallResultEvent toolCallResult, JsonSerializerOptions options)
at Microsoft.Agents.AI.AGUI.Shared.ChatResponseUpdateAGUIExtensions.ToolCallBuilder.EmitToolCallResult(ToolCallResultEvent toolCallResult, JsonSerializerOptions options)
at Microsoft.Agents.AI.AGUI.Shared.ChatResponseUpdateAGUIExtensions.<AsChatResponseUpdatesAsync>d__2.MoveNext()
at Microsoft.Agents.AI.AGUI.Shared.ChatResponseUpdateAGUIExtensions.<AsChatResponseUpdatesAsync>d__2.MoveNext()
at Microsoft.Agents.AI.AGUI.Shared.ChatResponseUpdateAGUIExtensions.<AsChatResponseUpdatesAsync>d__2.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult(Int16 token)
at Microsoft.Agents.AI.AGUI.AGUIChatClient.AGUIChatClientHandler.<GetStreamingResponseAsync>d__9.MoveNext()
at Microsoft.Agents.AI.AGUI.AGUIChatClient.AGUIChatClientHandler.<GetStreamingResponseAsync>d__9.MoveNext()
at Microsoft.Agents.AI.AGUI.AGUIChatClient.AGUIChatClientHandler.<GetStreamingResponseAsync>d__9.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult(Int16 token)
at Microsoft.Extensions.AI.FunctionInvokingChatClient.<GetStreamingResponseAsync>d__42.MoveNext()
at Microsoft.Extensions.AI.FunctionInvokingChatClient.<GetStreamingResponseAsync>d__42.MoveNext()
at Microsoft.Extensions.AI.FunctionInvokingChatClient.<GetStreamingResponseAsync>d__42.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult(Int16 token)
at Microsoft.Agents.AI.AGUI.AGUIChatClient.<GetStreamingResponseAsync>d__4.MoveNext()
at Microsoft.Agents.AI.AGUI.AGUIChatClient.<GetStreamingResponseAsync>d__4.MoveNext()
at Microsoft.Agents.AI.AGUI.AGUIChatClient.<GetStreamingResponseAsync>d__4.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult(Int16 token)
at Microsoft.Agents.AI.ChatClientAgent.<RunCoreStreamingAsync>d__29.MoveNext()
at Microsoft.Agents.AI.ChatClientAgent.<RunCoreStreamingAsync>d__29.MoveNext()
at Microsoft.Agents.AI.ChatClientAgent.<RunCoreStreamingAsync>d__29.MoveNext()
at Microsoft.Agents.AI.ChatClientAgent.<RunCoreStreamingAsync>d__29.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult(Int16 token)
at Microsoft.Agents.AI.AIAgent.<RunStreamingAsync>d__33.MoveNext()
at Microsoft.Agents.AI.AIAgent.<RunStreamingAsync>d__33.MoveNext()
at Microsoft.Agents.AI.AIAgent.<RunStreamingAsync>d__33.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult(Int16 token)
at ServerFunctionApprovalClientAgent.<RunCoreStreamingAsync>d__3.MoveNext() in \agent-framework-main\dotnet\samples\02-agents\AGUI\Step04_HumanInLoop\Client\ServerFunctionApprovalClientAgent.cs:line 45
at ServerFunctionApprovalClientAgent.<RunCoreStreamingAsync>d__3.MoveNext() in agent-framework-main\dotnet\samples\02-agents\AGUI\Step04_HumanInLoop\Client\ServerFunctionApprovalClientAgent.cs:line 45
at ServerFunctionApprovalClientAgent.<RunCoreStreamingAsync>d__3.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult(Int16 token)
at Microsoft.Agents.AI.AIAgent.<RunStreamingAsync>d__33.MoveNext()
at Microsoft.Agents.AI.AIAgent.<RunStreamingAsync>d__33.MoveNext()
at Microsoft.Agents.AI.AIAgent.<RunStreamingAsync>d__33.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult(Int16 token)
at Program.<<Main>$>d__0.MoveNext() in agent-framework-main (1)\agent-framework-main\dotnet\samples\02-agents\AGUI\Step04_HumanInLoop\Client\Program.cs:line 55
at Program.<<Main>$>d__0.MoveNext() in agent-framework-main (1)\agent-framework-main\dotnet\samples\02-agents\AGUI\Step04_HumanInLoop\Client\Program.cs:line 55
This exception was originally thrown at this call stack:
[External Code]
Inner Exception 1:
JsonReaderException: 'T' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0.Package Versions
Microsoft.Agents.AI 1.6.2
.NET Version
No response
Additional Context
No response
Metadata
Metadata
Assignees
Labels
.NETUsage: [Issues, PRs], Target: .NetUsage: [Issues, PRs], Target: .Netag-uiUsage: [Issues, PRs], Target: AG-UI protocol integrationUsage: [Issues, PRs], Target: AG-UI protocol integrationbugUsage: [Issues], Target: all issues (Legacy, prefer issue type: bug)Usage: [Issues], Target: all issues (Legacy, prefer issue type: bug)reproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflowUsage: [Issues], Target: all issues that can be reproduced by the triage workflow
Type
Projects
- StatusShow more project fieldsDone
Activity
github-actions commentedon May 31, 2026
🤖 Automated triage reproduction notes (agent-authored — trust but verify)
Agent analysis
Repro: DeserializeResultIfAvailable() in dotnet/src/Microsoft.Agents.AI.AGUI/Shared/ChatResponseUpdateAGUIExtensions.cs:431 throws JsonException when ToolCallResultEvent.Content is a non-JSON string like "True" or "False". The mismatch is with SerializeResultContent() at line 742 which passes strings through as-is (
string str => str) without JSON-encoding them. Minimal repro: send a ToolCallResultEvent with Content="True" through AsChatResponseUpdatesAsync; the fix should either JSON-encode strings in SerializeResultContent or gracefully handle non-JSON strings in DeserializeResultIfAvailable (e.g., wrap as a JSON string or return the raw string).dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/ToolCallResultDeserializationTests.cs1.6.21.8.0Mohanr1122 commentedon May 31, 2026
Same issue when adding handoffbuillder as agent
javiercn commentedon Aug 18, 2026
This was resolved by the AGUI.Client migration in #6653. The old in-tree result deserializer that attempted to parse
True/Falseas JSON was removed; current AGUI.Client carries the tool result content directly. Closing as resolved.