microsoft/autogen · error · InvalidOperationException
Function call is not supported in the semantic kernel if it'
Error message
Function call is not supported in the semantic kernel if it's from others.
What it means
Thrown by SemanticKernelChatMessageContentConnector.ProcessMessageForOthers when converting a message from another agent whose Content is null while both FunctionName and FunctionArguments are set. The connector has no way to represent an incoming function-call message from a third-party agent as a ChatMessageContent, so it refuses explicitly rather than silently dropping the call.
Source
Thrown at dotnet/src/AutoGen.SemanticKernel/Middleware/SemanticKernelChatMessageContentConnector.cs:260
{
throw new System.InvalidOperationException("Unsupported message type");
}
}
[Obsolete("This method is deprecated, please use the specific method instead.")]
private IEnumerable<ChatMessageContent> ProcessMessageForOthers(Message message)
{
if (message.Role == Role.System)
{
return [new ChatMessageContent(AuthorRole.System, message.Content)];
}
else if (message.Content is string && message.FunctionName is null && message.FunctionArguments is null)
{
return [new ChatMessageContent(AuthorRole.User, message.Content)];
}
else if (message.Content is null && message.FunctionName is not null && message.FunctionArguments is not null)
{
throw new System.InvalidOperationException("Function call is not supported in the semantic kernel if it's from others.");
}
else
{
throw new System.InvalidOperationException("Unsupported message type");
}
}
}
View on GitHub (pinned to 027ecf0a37)
Solutions
- Filter function-call messages out of the history before passing it to the SemanticKernel agent (keep only string-content turns)
- Convert the function call into a textual summary (e.g. $"{FunctionName}({FunctionArguments})") and pass that as Content instead
- Route function-call messages to an agent that supports them (e.g. an OpenAI agent) instead of the SemanticKernel agent
- Upgrade to a newer AutoGen.SemanticKernel version with a redesigned connector that handles function-call history
Example fix
// before var history = conversationMessages; // includes other agents' function-call messages await skAgent.GenerateReplyAsync(history); // after var history = conversationMessages.Where(m => m.Content is string); await skAgent.GenerateReplyAsync(history);
Defensive patterns
Strategy: validation
Validate before calling
bool IsFunctionCallFromOther(IMessage m) =>
m.Content is null && m.FunctionName is not null && m.FunctionArguments is not null;
// strip other agents' function calls before calling the SK agent
var filtered = messages.Where(m => !IsFunctionCallFromOther(m)); Try / catch
try { reply = await skAgent.GenerateReplyAsync(history); }
catch (InvalidOperationException ex) when (ex.Message.Contains("from others"))
{
history = history.Where(m => m.Content is not null || m.FunctionName is null);
reply = await skAgent.GenerateReplyAsync(history); // retry with cleaned history
} Prevention
- In group chats, forward only string-content turns to SemanticKernel agents
- Summarize function calls as text before cross-agent routing
- Keep function-call-aware agents (OpenAI) as the destination for tool-invocation messages
When it happens
Trigger: A group-chat or middleware pipeline forwards another agent's function-call Message (Content=null, FunctionName!=null, FunctionArguments!=null) into a SemanticKernel agent that uses this connector.
Common situations: Multi-agent orchestration where an OpenAI/function-calling agent's tool-invocation message is routed to a SemanticKernel agent; middleware that copies the whole conversation history, including function-call turns, into every participant.
Related errors
- Unsupported content type
- unsupported message type, only support TextMessage, ImageMes
- MultiModalMessage is not supported in the semantic kernel if
- Failed to review code block
- Please set OPENAI_API_KEY environment variable.
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/8d04ccd030f32eac.
Report an issue: GitHub.