microsoft/semantic-kernel · error · KernelException
The specified function {function.Id} is not available in the
Error message
The specified function {function.Id} is not available in the kernel. What it means
Thrown by AgentDefinitionExtensions.GetDefaultKernelArguments when a function tool referenced in the AgentDefinition cannot be found in the kernel's plugin collection. The function.Id is parsed via FunctionName.Parse using '.' as the separator into PluginName and Name, then kernel.Plugins.TryGetFunction is called; if it returns false, this KernelException is thrown.
Source
Thrown at dotnet/src/Agents/Abstractions/Extensions/AgentDefinitionExtensions.cs:48
ExtensionData = agentDefinition.Model?.Options ?? new Dictionary<string, object>()
};
// Enable automatic function calling if functions are defined.
var functions = agentDefinition.GetToolDefinitions(FunctionType);
if (functions is not null)
{
List<KernelFunction> kernelFunctions = [];
foreach (var function in functions)
{
var nameParts = FunctionName.Parse(function.Id!, FunctionNameSeparator);
// Look up the function in the kernel.
if (kernel.Plugins.TryGetFunction(nameParts.PluginName, nameParts.Name, out var kernelFunction))
{
kernelFunctions.Add(kernelFunction);
continue;
}
throw new KernelException($"The specified function {function.Id} is not available in the kernel.");
}
executionSettings.FunctionChoiceBehavior = FunctionChoiceBehavior.Auto(kernelFunctions);
}
var arguments = new KernelArguments(executionSettings);
if (agentDefinition?.Inputs is not null)
{
// Add default arguments for the agent
foreach (var keyValuePair in agentDefinition.Inputs)
{
if (keyValuePair.Value.Default is not null)
{
arguments.Add(keyValuePair.Key, keyValuePair.Value.Default);
}
}
}
View on GitHub (pinned to c028a0c7dc)
Solutions
- Register the plugin on the kernel with the exact name used in the function id: kernel.Plugins.AddFromType<MyPlugin>("MyPlugin").
- Verify the function id in the definition matches "PluginName.FunctionName" format.
- Check that the function method exists in the plugin class and is decorated/registered correctly.
- Call kernel.Plugins.TryGetFunction(pluginName, funcName, out _) in a debug step to verify registration.
Example fix
// before — definition has tool id "SearchPlugin.Search"
// but kernel has no plugin named SearchPlugin
// after
var kernel = new Kernel();
kernel.Plugins.AddFromType<SearchPlugin>("SearchPlugin"); Defensive patterns
Strategy: validation
Validate before calling
foreach (var func in definition.GetToolDefinitions("function") ?? [])
{
var parts = FunctionName.Parse(func.Id!, ".");
if (!kernel.Plugins.TryGetFunction(parts.PluginName, parts.Name, out _))
{
throw new InvalidOperationException(
$"Function '{func.Id}' is not registered in the kernel.");
}
} Try / catch
try
{
var args = definition.GetDefaultKernelArguments(kernel);
}
catch (KernelException ex) when (ex.Message.Contains("not available in the kernel"))
{
_logger.LogError("Missing kernel function: {Message}", ex.Message);
throw;
} Prevention
- Register all referenced plugins on the kernel before calling GetDefaultKernelArguments.
- Use consistent naming between definition files and plugin registration.
- Write a startup validation that checks all function tool ids resolve to kernel functions.
When it happens
Trigger: An agent definition lists function tools (type "function") with ids like "MyPlugin.MyFunction", but the kernel has no plugin named "MyPlugin" or no function named "MyFunction" within it. The function id format is "PluginName.FunctionName" separated by a dot.
Common situations: Plugin not registered on the kernel before GetDefaultKernelArguments is called. Mismatched plugin/function names between the definition file and the registered KernelPlugin. Function id missing the plugin prefix (just "MyFunction" with no dot). Typo in the definition. Plugins registered under a different name than expected.
Related errors
- Plugin creation failed for {pluginName}
- Data is not available for {cityName}.
- Plugins directory not found. The app needs the plugins from
- Unable to restore channel: invalid state.
- Unexpected failure broadcasting to channel: {channelRef.Chan
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/3e8103c459afa92c.
Report an issue: GitHub.