Skip to main content
⚠️ KeyNotFoundException / HttpOperationException Semantic Kernel 1.54+ .NET 10 ✓ Verified Oct 2026

Fix: Semantic Kernel Plugin Function Not Found Exception in C#

Fix Semantic Kernel Plugin Function Not Found error in C#. Solve missing [KernelFunction] attributes, naming collisions, and plugin registration order.

Raw Error Payload / Console String
{
  "error": "Microsoft.SemanticKernel.KernelException: Function 'GetOrderDetails' not found in plugin 'OrdersPlugin'. Registered plugins: [Math, Time]"
}

Trigger Scenario

The LLM executes a tool call invoking a plugin function that was not registered on the current Kernel instance.

Root Cause

Missing [KernelFunction] attribute on target method, plugin added to service collection but not the specific Kernel instance, or case sensitivity in function names.

Step-by-Step Resolution

1
Decorate method with [KernelFunction] Ensure the public C# method has [KernelFunction] and [Description] attributes.
2
Add plugin to Kernel instance Call kernel.Plugins.AddFromType<MyPlugin>("OrdersPlugin") before calling InvokePromptAsync.
3
Enable auto function invocation Set FunctionChoiceBehavior = FunctionChoiceBehavior.Auto() in PromptExecutionSettings.
Verified C# (.NET 10) Solution Code
public class OrdersPlugin
{
    [KernelFunction("GetOrderDetails")]
    [System.ComponentModel.Description("Fetches customer order details by order ID.")]
    public string GetOrder(string orderId) => $"Order {orderId}: Shipped";
}

// Register cleanly on Kernel
var kernel = Kernel.CreateBuilder().AddAzureOpenAIChatCompletion(...).Build();
kernel.Plugins.AddFromType<OrdersPlugin>("OrdersPlugin");
Comprehensive Engineering Guide

Fix Semantic Kernel Plugin and Function Errors in C#

Read Full Deep Dive