{"record":{"id":"fe9d5fabcc913e66","repo":"microsoft/semantic-kernel","slug":"plugin-plugin-name-not-found-in-kernel","errorCode":null,"errorMessage":"Plugin '{plugin_name}' not found in kernel.","messagePattern":"Plugin '(.+?)' not found in kernel\\.","errorType":"validation","errorClass":"AgentInitializationException","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/agents/agent.py","lineNumber":1063,"sourceCode":"        This validates the declared tools in the YAML spec, and only checks whether those references resolve\n        properly in the current kernel.\n        \"\"\"\n        if not kernel:\n            raise AgentInitializationException(\"Kernel instance is required for tool resolution.\")\n\n        for tool in tools_list:\n            tool_id = tool.get(\"id\")\n            if not tool_id or tool.get(\"type\") != \"function\":\n                continue\n\n            if \".\" not in tool_id:\n                raise AgentInitializationException(f\"Tool id '{tool_id}' must be in format PluginName.FunctionName\")\n\n            plugin_name, function_name = tool_id.split(\".\", 1)\n\n            plugin = kernel.plugins.get(plugin_name)\n            if not plugin:\n                raise AgentInitializationException(f\"Plugin '{plugin_name}' not found in kernel.\")\n\n            if function_name not in plugin.functions:\n                raise AgentInitializationException(f\"Function '{function_name}' not found in plugin '{plugin_name}'.\")\n\n\n# endregion\n","sourceCodeStart":1045,"sourceCodeEnd":1070,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/agents/agent.py#L1045-L1070","documentation":"Thrown by _validate_tools after splitting a tool id into plugin/function when kernel.plugins.get(plugin_name) returns nothing. The plugin namespace named in the tool id was never registered on the kernel, so the reference cannot resolve.","triggerScenarios":"Tool id `WebPlugin.search` but the kernel only has a plugin registered under a different name (e.g. 'Web') or no plugin registered at all.","commonSituations":"Plugin registered with a different plugin_name than the YAML expects; plugin registration code path skipped in the current config; typo in the plugin prefix.","solutions":["Register the plugin under the exact name used in the tool id: `kernel.add_plugin(WebPlugin(), plugin_name='WebPlugin')`.","Correct the tool id prefix in the YAML to match the registered plugin name.","List `kernel.plugins.get_directory()` (or iterate kernel.plugins) to confirm available plugin names before loading."],"exampleFix":"# before\nkernel.add_plugin(WebPlugin(), plugin_name='Web')\n# yaml: id: WebPlugin.search\n\n# after\nkernel.add_plugin(WebPlugin(), plugin_name='WebPlugin')\n# yaml: id: WebPlugin.search","handlingStrategy":"validation","validationCode":"for t in spec.get('tools', []):\n    if t.get('type') != 'function' or not t.get('id') or '.' not in t['id']:\n        continue\n    plugin_name = t['id'].split('.', 1)[0]\n    assert kernel.plugins.get(plugin_name), f'Plugin {plugin_name!r} not registered on kernel'","typeGuard":"def plugin_is_registered(tool: dict, kernel) -> bool:\n    tid = tool.get('id', '')\n    if '.' not in tid:\n        return True\n    return kernel.plugins.get(tid.split('.', 1)[0]) is not None","tryCatchPattern":"from semantic_kernel.exceptions.agent_exceptions import AgentInitializationException\ntry:\n    agent = await AgentRegistry.create_from_yaml(yaml_str, kernel=kernel)\nexcept AgentInitializationException as e:\n    if 'not found in kernel' in str(e):\n        name = str(e).split(\"'\")[1]\n        kernel.add_plugin(MyPlugin(), plugin_name=name)\n        agent = await AgentRegistry.create_from_yaml(yaml_str, kernel=kernel)\n    else:\n        raise","preventionTips":["Register plugins under the exact names referenced by tool ids.","List kernel plugin names before loading the spec."],"tags":["kernel","plugins","tools","validation","semantic-kernel"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}