Skip to content

.Net: Net: Bug: 'd' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0. #13299

@jeffrey55wu

Description

@jeffrey55wu

Describe the bug
Intermittently, calling AzureOpenAlChatCompletion.GetChatMessageContentAsync(...) throws a System.Text.Json.JsonReaderException with the message: "'d' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0." The exception appears to originate from OpenAl.Chat.ChatCompletion.FromResponse (OpenAl.Chat.ChatCompletion.op_Explicit), suggesting the SDK is attempting to parse a non-JSON response body.
This happens sporadically in production (roughly once or twice per day) even when sending the same normalized transcript. Most calls succeed; some fail with the above exception.

To Reproduce
Note: This is intermittent and hard to reproduce deterministically.

  1. Initialize Semantic Kernel with Azure OpenAl chat completion.
  2. Prepare a normalized transcript and a simple "summarize" prompt.
  3. Call GetChatMessageContentAsync with non-streaming settings.
  4. Observe occasional JsonReaderException parsing the response.

Expected behavior
The call should return a summary string (ChatMessageContent) consistently. No JsonReaderException should be thrown, and the SDK should handle or surface non-JSON responses gracefully.

Screenshots
N/A

Platform

  • Language: C#
  • Source: <PackageReference Include="Microsoft.SemanticKernel" Version="1.65.0" />
  • Al model: OpenAl:GPT-40-mini (2024-07-18)
  • SDK version: dotnet8.0.19:0tel1.8.1:ext1.3.0-d
  • Connector: Azure OpenAl Chat Completion

Additional context
Frequency: Intermittent; typically 1-2 occurrences per day under production load.
Input: A normalized transcript (string) used for summarization. The same input can succeed or fail unpredictably.

Workarounds tried
Retrying the failed call usually succeeds on subsequent attempts, which further suggests a transient service or transport response issue rather than input-related formatting.
Ensuring non-streaming settings (no explicit stream flags set) and basic prompt formatting did not resolve the intermittent failures.

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETIssue or Pull requests regarding .NET codebugSomething isn't workingtriage

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions