microsoft/autogen · error · NotSupportedException
VarObject {response.VarObject} is not supported
Error message
VarObject {response.VarObject} is not supported What it means
NotSupportedException from the streaming path: the connector requires every ChatCompletionResponse chunk to have object == "chat.completion.chunk". A chunk with a different object value (commonly "chat.completion" when streaming was silently disabled, or an error object) is rejected.
Source
Thrown at dotnet/src/AutoGen.Mistral/Middleware/MistralChatMessageConnector.cs:175
}
else if (finishReason == Choice.FinishReasonEnum.ToolCalls)
{
var functionContents = choice.Message?.ToolCalls ?? throw new ArgumentNullException("choice.Message.ToolCalls");
var toolCalls = functionContents.Select(f => new ToolCall(f.Function.Name, f.Function.Arguments) { ToolCallId = f.Id }).ToList();
return new ToolCallMessage(toolCalls, from: from.Name);
}
else
{
throw new NotSupportedException($"FinishReason {finishReason} is not supported");
}
}
private IMessage? ProcessChatCompletionResponse(IMessage<ChatCompletionResponse> message, IAgent agent)
{
var response = message.Content;
if (response.VarObject != "chat.completion.chunk")
{
throw new NotSupportedException($"VarObject {response.VarObject} is not supported");
}
if (response.Choices is null)
{
throw new ArgumentNullException("response.Choices");
}
if (response.Choices?.Count != 1)
{
throw new NotSupportedException("response.Choices.Count != 1");
}
var choice = response.Choices[0];
var delta = choice.Delta;
// process text message if delta.content is not null
if (delta?.Content is string content)
{
return new TextMessageUpdate(role: Role.Assistant, content, from: agent.Name);View on GitHub (pinned to 027ecf0a37)
Solutions
- Verify the raw SSE lines (data: {...}) from the Mistral endpoint and check the "object" field of each chunk.
- If a proxy buffers the stream, bypass it for Mistral traffic or disable response buffering for text/event-stream.
- If streaming is genuinely unavailable, use the non-streaming GenerateReplyAsync path instead.
- Align mocks/tests to emit object="chat.completion.chunk" payloads.
Example fix
// before
if (response.VarObject != "chat.completion.chunk")
{
throw new NotSupportedException($"VarObject {response.VarObject} is not supported");
}
// after
if (response.VarObject == "chat.completion")
{
// full completion object where a chunk was expected: fall back to non-streaming processing
return ProcessChatCompletionResponse(message, agent);
}
if (response.VarObject != "chat.completion.chunk")
{
throw new NotSupportedException($"VarObject {response.VarObject} is not supported");
} Defensive patterns
Strategy: validation
Validate before calling
// verify streaming actually works before relying on it
var probe = await client.StreamingChatCompletionsAsync(testRequest).FirstOrDefaultAsync();
if (probe?.VarObject != "chat.completion.chunk")
{
// endpoint/proxy does not deliver chunks: use non-streaming calls instead
} Type guard
static bool IsChunk(ChatCompletionResponse r) => r?.VarObject == "chat.completion.chunk";
Try / catch
catch (NotSupportedException ex) when (ex.Message.Contains("VarObject"))
{
// fall back to non-streaming GenerateReplyAsync for this agent
} Prevention
- Disable response buffering on proxies for text/event-stream
- Test the streaming path against your real endpoint (not mocks) before shipping
When it happens
Trigger: Calling GenerateStreamingReplyAsync on a Mistral agent but receiving non-chunk objects. Typical causes: an intermediary proxy that buffers SSE and returns one full "chat.completion" object; the request's stream flag being overridden; or a non-streaming response fed into the streaming processor in tests.
Common situations: Corporate proxies or gateways (Azure API Management, nginx buffering) collapsing SSE streams; mocking helpers returning full completion objects into streaming code paths; version drift where the object field name/serialization changes.
Related errors
- Failed to deserialize response
- response.Choices.Count != 1
- FinishReason {finishReason} is not supported
- Role {textMessage.Role} is not supported
- Invalid JSON response from server. Check if the MCP route is
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/3ea153e027bc7ea2.
Report an issue: GitHub.