Skip to content

[BUG] ChatClientAgent.RunAsync throws JSON parsing error with gpt-5 but works with gpt-4o #55561

@dantatepico

Description

@dantatepico

Library name and version

Microsoft.Agents.AI 1.0.0-preview.260128.1

Describe the bug

We’re encountering a JSON parsing exception when using ChatClientAgent.RunAsync with the gpt-5 model. The same code works correctly when switching to gpt-4o.

This appears to be either a service-side incompatibility with Agents or an SDK parsing issue when handling the final response block.

Expected behavior

ChatClientAgent.RunAsync returns an AgentResponse

Actual behavior

ChatClientAgent.RunAsync throws an exception:

The input does not contain any JSON tokens. Expected the input to start with a valid JSON token, when isFinalBlock is true. LineNumber: 0 | BytePositionInLine: 0.

Reproduction Steps

    var chatMessage = new ChatMessage
    {
      Role = ChatRole.User,
      Contents = [new DataContent(image, "image/png")]
    };

    var response = await _chatClientAgent.RunAsync(chatMessage, session, cancellationToken: ct);

Environment

.NET 10 Windows
Visual Studio 18.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    AI AgentsClientThis issue is related to a non-management packageService AttentionWorkflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions