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 self.
What it means
The deprecated-Message handler for self-authored messages only supports plain text. A legacy Message with null Content but non-null FunctionName/FunctionArguments (i.e. a function call from the agent itself) cannot be represented in SK chat content and throws InvalidOperationException.
Source
Thrown at dotnet/src/AutoGen.SemanticKernel/Middleware/SemanticKernelChatMessageContentConnector.cs:239
}
}
return [new ChatMessageContent(AuthorRole.User, collections)];
}
[Obsolete("This method is deprecated, please use the specific method instead.")]
private IEnumerable<ChatMessageContent> ProcessMessageForSelf(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.Assistant, 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 self.");
}
else
{
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)];
}View on GitHub (pinned to 027ecf0a37)
Solutions
- Migrate from the obsolete Message type to ToolCallMessage/ToolCallResultMessage and use a connector that supports tool calls.
- Convert legacy function-call Messages into a textual summary TextMessage before replay to an SK agent.
- Filter self function-call Messages out of the history sent to SK agents.
Example fix
// before (legacy)
var legacy = new Message(Role.Assistant, null, functionName: "get_weather", functionArguments: "{\"city\":\"sf\"}", from: skAgent.Name);
await skAgent.SendAsync(new[] { legacy });
// after
var summary = new TextMessage(Role.Assistant, "Called get_weather({\"city\":\"sf\"})", from: skAgent.Name);
await skAgent.SendAsync(new[] { summary }); Defensive patterns
Strategy: fallback
Validate before calling
// Convert legacy function-call Messages to text summaries before replay
var replayable = history.Select(m => m is Message msg && msg.FunctionName is not null && msg.Content is null
? new TextMessage(Role.Assistant, $"Called {msg.FunctionName}({msg.FunctionArguments})", from: msg.From)
: (IMessage)m); Type guard
static bool IsLegacySelfFunctionCall(IMessage m, string agentName) =>
m is Message msg && msg.From == agentName && msg.Content is null && msg.FunctionName is not null; Try / catch
catch (InvalidOperationException ex) when (ex.Message.Contains("Function call is not supported"))
{
logger.LogWarning("Dropping legacy self function-call message");
return await skAgent.SendAsync(history.Where(m => !IsLegacySelfFunctionCall(m, skAgent.Name)));
} Prevention
- Migrate persistence layers off the obsolete Message type to ToolCallMessage/ToolCallResultMessage.
- Treat legacy logs as needing normalization before replay into SK agents.
When it happens
Trigger: Replaying a legacy Message representing a self function call (Content == null, FunctionName != null, FunctionArguments != null) to the same SK agent.
Common situations: Migrating old AutoGen conversations built on the obsolete Message type; replaying stored logs that captured function-call turns as Message objects.
Related errors
- Missing parameter type for {parameterName}
- Missing required parameter: {parameterName}
- Unsupported content type
- Only one choice is supported in streaming response
- The method or operation is not implemented.
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/3a59aa64256f4f5f.
Report an issue: GitHub.