{"record":{"id":"21dd9b9916b8258f","repo":"microsoft/semantic-kernel","slug":"sample-plugin-path-not-found","errorCode":null,"errorMessage":"Sample plugin path not found.","messagePattern":"Sample plugin path not found\\.","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"python/samples/demos/telemetry/scenarios.py","lineNumber":34,"sourceCode":"\n\ndef set_up_kernel() -> Kernel:\n    # Create a kernel and add services and plugins\n    kernel = Kernel()\n\n    # All built-in AI services are instrumented with telemetry.\n    # Select any AI service to see the telemetry in action.\n    kernel.add_service(OpenAIChatCompletion(service_id=\"open_ai\"))\n    # kernel.add_service(\n    #     AzureAIInferenceChatCompletion(\n    #         ai_model_id=\"serverless-deployment\",\n    #         service_id=\"azure-ai-inference\",\n    #     )\n    # )\n    # kernel.add_service(GoogleAIChatCompletion(service_id=\"google_ai\"))\n\n    if (sample_plugin_path := get_sample_plugin_path()) is None:\n        raise FileNotFoundError(\"Sample plugin path not found.\")\n    kernel.add_plugin(\n        plugin_name=\"WriterPlugin\",\n        parent_directory=sample_plugin_path,\n    )\n    kernel.add_plugin(WeatherPlugin(), \"WeatherPlugin\")\n    kernel.add_plugin(LocationPlugin(), \"LocationPlugin\")\n\n    return kernel\n\n\n#############################################################\n# Below are scenarios that are instrumented with telemetry. #\n#############################################################\n\n\nasync def run_ai_service(stream: bool = False) -> None:\n    \"\"\"Run an AI service.\n","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/samples/demos/telemetry/scenarios.py#L16-L52","documentation":"Thrown while building the kernel for the telemetry demo: get_sample_plugin_path() returned None, so the WriterPlugin sample folder could not be located on disk. The helper returns None when it cannot resolve the path to the bundled sample plugins (e.g. the script is run from an unexpected working directory or the repo layout changed).","triggerScenarios":"Running scenarios.py from a directory where the relative lookup for the sample plugins fails; running against an installed package that did not ship the sample plugin folder; moved/renamed repo directories.","commonSituations":"Executing the demo from outside the expected python/samples tree; running from an editable install whose sample resources aren't on the path; partial checkout of the repo missing the prompts/plugins folders.","solutions":["Run the script from the repository's expected location (e.g. python/samples/demos/telemetry) so the relative plugin path resolves.","Inspect get_sample_plugin_path() to see which path it probes and verify that folder exists on disk.","If the folder is missing, restore it from the repo (it ships sample WriterPlugin prompt templates).","Pass/run with the repo checked out completely rather than an installed wheel that omits samples."],"exampleFix":"# Verify the path the helper expects exists\nfrom scenarios import get_sample_plugin_path\np = get_sample_plugin_path()\nprint(p)  # must not be None; ensure cwd/repo layout matches expectations\n# Run from the directory the sample was designed for.","handlingStrategy":"validation","validationCode":"from scenarios import get_sample_plugin_path\np = get_sample_plugin_path()\nassert p is not None and Path(p).exists(), f'Sample plugin path missing: {p}'","typeGuard":null,"tryCatchPattern":"try:\n    kernel = configure_kernel()\nexcept FileNotFoundError as e:\n    print('Run this sample from the repository sample directory:', e)\n    raise","preventionTips":["Run samples from their intended directory in the repo.","Keep the full repo checked out so sample resources are present.","Verify get_sample_plugin_path()'s expected directory exists before running.","Don't rely on an installed wheel that omits the samples folder."],"tags":["telemetry","plugins","file-path","sample","demo"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}