{"record":{"id":"8d04ccd030f32eac","repo":"microsoft/autogen","slug":"function-call-is-not-supported-in-the-semantic-ker-8d04cc","errorCode":null,"errorMessage":"Function call is not supported in the semantic kernel if it's from others.","messagePattern":"Function call is not supported in the semantic kernel if it's from others\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"dotnet/src/AutoGen.SemanticKernel/Middleware/SemanticKernelChatMessageContentConnector.cs","lineNumber":260,"sourceCode":"        {\n            throw new System.InvalidOperationException(\"Unsupported message type\");\n        }\n    }\n\n    [Obsolete(\"This method is deprecated, please use the specific method instead.\")]\n    private IEnumerable<ChatMessageContent> ProcessMessageForOthers(Message message)\n    {\n        if (message.Role == Role.System)\n        {\n            return [new ChatMessageContent(AuthorRole.System, message.Content)];\n        }\n        else if (message.Content is string && message.FunctionName is null && message.FunctionArguments is null)\n        {\n            return [new ChatMessageContent(AuthorRole.User, message.Content)];\n        }\n        else if (message.Content is null && message.FunctionName is not null && message.FunctionArguments is not null)\n        {\n            throw new System.InvalidOperationException(\"Function call is not supported in the semantic kernel if it's from others.\");\n        }\n        else\n        {\n            throw new System.InvalidOperationException(\"Unsupported message type\");\n        }\n    }\n}\n","sourceCodeStart":242,"sourceCodeEnd":268,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/dotnet/src/AutoGen.SemanticKernel/Middleware/SemanticKernelChatMessageContentConnector.cs#L242-L268","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nvar history = conversationMessages; // includes other agents' function-call messages\nawait skAgent.GenerateReplyAsync(history);\n\n// after\nvar history = conversationMessages.Where(m => m.Content is string);\nawait skAgent.GenerateReplyAsync(history);","handlingStrategy":"validation","validationCode":"bool IsFunctionCallFromOther(IMessage m) =>\n    m.Content is null && m.FunctionName is not null && m.FunctionArguments is not null;\n\n// strip other agents' function calls before calling the SK agent\nvar filtered = messages.Where(m => !IsFunctionCallFromOther(m));","typeGuard":null,"tryCatchPattern":"try { reply = await skAgent.GenerateReplyAsync(history); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"from others\"))\n{\n    history = history.Where(m => m.Content is not null || m.FunctionName is null);\n    reply = await skAgent.GenerateReplyAsync(history); // retry with cleaned history\n}","preventionTips":["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"],"tags":["csharp","semantic-kernel","function-calling","group-chat"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}