microsoft/semantic-kernel · error · KernelException
The specified {nameof(EnabledFunctions)} function {f.FullyQu
Error message
The specified {nameof(EnabledFunctions)} function {f.FullyQualifiedName} is not available in the kernel. What it means
With EnabledFunctions and auto-invocation on, ConfigureOptions iterates each enabled function and calls kernel.Plugins.TryGetFunction(pluginName, functionName). If any function is not registered in the kernel's plugins, KernelException is thrown. The function metadata was advertised to the model but cannot be found for execution.
Source
Thrown at dotnet/src/Connectors/Connectors.OpenAI/ToolCallBehavior.cs:220
// on the consumers behalf: if they specify auto-invocation with any functions, they must
// specify the kernel and the kernel must contain those functions.
if (autoInvoke && kernel is null)
{
throw new KernelException($"Auto-invocation with {nameof(EnabledFunctions)} is not supported when no kernel is provided.");
}
choice = ChatToolChoice.CreateAutoChoice();
tools = [];
for (int i = 0; i < openAIFunctions.Length; i++)
{
// Make sure that if auto-invocation is specified, every enabled function can be found in the kernel.
if (autoInvoke)
{
Debug.Assert(kernel is not null);
OpenAIFunction f = openAIFunctions[i];
if (!kernel!.Plugins.TryGetFunction(f.PluginName, f.FunctionName, out _))
{
throw new KernelException($"The specified {nameof(EnabledFunctions)} function {f.FullyQualifiedName} is not available in the kernel.");
}
}
// Add the function.
tools.Add(functions[i]);
}
}
return (tools, choice);
}
}
/// <summary>Represents a <see cref="ToolCallBehavior"/> that requests the model use a specific function.</summary>
internal sealed class RequiredFunction : ToolCallBehavior
{
private readonly OpenAIFunction _function;
private readonly ChatTool _tool;
private readonly ChatToolChoice _choice;View on GitHub (pinned to c028a0c7dc)
Solutions
- Ensure kernel.Plugins contains a plugin with the exact name and function name referenced by each OpenAIFunction.
- Verify PluginName and FunctionName casing matches exactly — TryGetFunction is case-sensitive.
- Register the plugin before the chat call: kernel.Plugins.AddFromType<MyPlugin>("MyPlugin").
- Print kernel.Plugins.GetFunctionsMetadata() to confirm which functions are actually available.
Example fix
// before — function references a plugin not in the kernel
var functions = kernel.Plugins.GetFunctionsMetadata()
.Where(f => f.PluginName == "MissingPlugin").Select(OpenAIFunction.Create);
var behavior = ToolCallBehavior.EnableFunctions(functions, autoInvoke: true);
// after — register the plugin first, then build the function list from it
kernel.Plugins.AddFromType<WeatherPlugin>("WeatherPlugin");
var functions = kernel.Plugins["WeatherPlugin"].Select(f => OpenAIFunction.Create(f));
var behavior = ToolCallBehavior.EnableFunctions(functions, autoInvoke: true); Defensive patterns
Strategy: validation
Validate before calling
// Verify all enabled functions exist in the kernel before the chat call
foreach (var f in openAIFunctions)
{
if (!kernel.Plugins.TryGetFunction(f.PluginName, f.FunctionName, out _))
{
throw new InvalidOperationException(
$"Function {f.PluginName}.{f.FunctionName} is not registered in the kernel.");
}
} Try / catch
try { await chatService.GetChatMessageContentAsync(history, settings, kernel); }
catch (KernelException ex) when (ex.Message.Contains("not available in the kernel"))
{
// Log available functions for debugging
var available = string.Join(", ", kernel.Plugins.GetFunctionsMetadata().Select(f => $"{f.PluginName}.{f.FunctionName}"));
logger.LogError("Function not in kernel. Available: {Functions}", available);
throw;
} Prevention
- Build the OpenAIFunction list directly from kernel.Plugins to guarantee name consistency.
- Register all plugins before creating the behavior, not after.
- Use KernelFunctions (ToolCallBehavior.AutoInvokeKernelFunctions) to avoid manual function-list drift.
When it happens
Trigger: Registering ToolCallBehavior.EnabledFunctions with a list of OpenAIFunction objects whose PluginName/FunctionName don't match any function actually loaded into the kernel passed to the chat call.
Common situations: Building the OpenAIFunction list from one plugin instance but registering a different plugin (or a renamed one) in the kernel. Function name casing mismatch. Forgetting to call kernel.Plugins.Add(...) before invoking. Deserializing function metadata that references a plugin not yet loaded.
Related errors
- The specified {nameof(RequiredFunction)} function {this._fun
- Auto-invocation with {nameof(EnabledFunctions)} is not suppo
- The specified {nameof(EnabledFunctions)} function {func.Full
- Auto-invocation with {nameof(EnabledFunctions)} is not suppo
- Auto-invocation with {nameof(RequiredFunction)} is not suppo
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/a2608cf91fb04154.
Report an issue: GitHub.