microsoft/autogen · error · NotSupportedException

Expected Content to have one output

Error message

Expected Content to have one output

What it means

Error "Expected Content to have one output" thrown in microsoft/autogen.

Source

Thrown at dotnet/src/AutoGen.Anthropic/Middleware/AnthropicMessageConnector.cs:125

        if (response.Content is null)
        {
            throw new ArgumentNullException(nameof(response.Content));
        }

        // When expecting a tool call, sometimes the response will contain two messages, one chat and one tool.
        // The first message is typically a TextContent, of the LLM explaining what it is trying to do.
        // The second message contains the tool call.
        if (response.Content.Count > 1)
        {
            if (response.Content.Count == 2 && response.Content[0] is TextContent &&
                response.Content[1] is ToolUseContent toolUseContent)
            {
                return new ToolCallMessage(toolUseContent.Name ?? string.Empty,
                    toolUseContent.Input?.ToJsonString() ?? string.Empty,
                    from: from.Name);
            }

            throw new NotSupportedException($"Expected {nameof(response.Content)} to have one output");
        }

        var content = response.Content[0];
        switch (content)
        {
            case TextContent textContent:
                return new TextMessage(Role.Assistant, textContent.Text ?? string.Empty, from: from.Name);

            case ToolUseContent toolUseContent:
                return new ToolCallMessage(toolUseContent.Name ?? string.Empty,
                    toolUseContent.Input?.ToJsonString() ?? string.Empty,
                    from: from.Name);

            case ImageContent:
                throw new InvalidOperationException(
                    "Claude is an image understanding model only. It can interpret and analyze images, but it cannot generate, produce, edit, manipulate or create images");
            default:
                throw new ArgumentOutOfRangeException(nameof(content));

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Return a single output item per tool result; merge or select one result if multiple exist

Example fix

Collapse tool results to one output before constructing the ToolResultMessage

When it happens

Trigger: Thrown at dotnet/src/AutoGen.Anthropic/Middleware/AnthropicMessageConnector.cs:125 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15). Data as JSON: /api/errors/0a5322a737133f51. Report an issue: GitHub.