PluginFunctionNotFoundError
semantic_kernel.exceptions.PluginFunctionNotFoundError
Stack trace
semantic_kernel.exceptions.PluginFunctionNotFoundError: Plugin function 'my_plugin_function' not found in the registered plugins. at semantic_kernel.runtime.PluginManager.get_function(plugin_name='my_plugin', function_name='my_plugin_function') at semantic_kernel.runtime.ExecutionContext.invoke_plugin_function(...)
Why it happens
This error occurs because the Semantic Kernel runtime cannot locate the specified plugin function. It usually means the plugin was not registered correctly, the function name is misspelled, or the plugin assembly/module was not loaded before invocation.
Detection
Monitor plugin registration logs and catch PluginFunctionNotFoundError exceptions to log the missing function name and plugin context before the runtime fails.
Causes & fixes
The plugin containing the function was never registered with the kernel.
Ensure you call kernel.register_plugin() or equivalent registration method before invoking plugin functions.
The function name used in the invocation does not exactly match the registered function name (case-sensitive).
Verify and correct the function name string to exactly match the registered plugin function name.
The plugin assembly or module failed to load due to missing dependencies or incorrect path.
Check plugin loading logs and confirm all dependencies are present and the plugin path is correct.
Code: broken vs fixed
from semantic_kernel import Kernel
kernel = Kernel()
# Missing plugin registration here
result = kernel.invoke_plugin_function('my_plugin', 'my_plugin_function') # This line raises PluginFunctionNotFoundError import os
from semantic_kernel import Kernel
os.environ['SEMANTIC_KERNEL_API_KEY'] = os.environ.get('SEMANTIC_KERNEL_API_KEY', '') # Use env var for keys
kernel = Kernel()
kernel.register_plugin('my_plugin', '/path/to/my_plugin') # Plugin registered properly
result = kernel.invoke_plugin_function('my_plugin', 'my_plugin_function') # Now works
print(result) Workaround
Catch PluginFunctionNotFoundError and fallback to a default function or return a user-friendly error message while logging the missing function details.
Prevention
Always register all plugins and their functions during kernel initialization and validate function names with unit tests to avoid runtime lookup failures.