microsoft/semantic-kernel · error · FileNotFoundError
Sample plugin path not found.
Error message
Sample plugin path not found.
What it means
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).
Source
Thrown at python/samples/demos/telemetry/scenarios.py:34
def set_up_kernel() -> Kernel:
# Create a kernel and add services and plugins
kernel = Kernel()
# All built-in AI services are instrumented with telemetry.
# Select any AI service to see the telemetry in action.
kernel.add_service(OpenAIChatCompletion(service_id="open_ai"))
# kernel.add_service(
# AzureAIInferenceChatCompletion(
# ai_model_id="serverless-deployment",
# service_id="azure-ai-inference",
# )
# )
# kernel.add_service(GoogleAIChatCompletion(service_id="google_ai"))
if (sample_plugin_path := get_sample_plugin_path()) is None:
raise FileNotFoundError("Sample plugin path not found.")
kernel.add_plugin(
plugin_name="WriterPlugin",
parent_directory=sample_plugin_path,
)
kernel.add_plugin(WeatherPlugin(), "WeatherPlugin")
kernel.add_plugin(LocationPlugin(), "LocationPlugin")
return kernel
#############################################################
# Below are scenarios that are instrumented with telemetry. #
#############################################################
async def run_ai_service(stream: bool = False) -> None:
"""Run an AI service.
View on GitHub (pinned to c028a0c7dc)
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.
Example fix
# Verify the path the helper expects exists from scenarios import get_sample_plugin_path p = get_sample_plugin_path() print(p) # must not be None; ensure cwd/repo layout matches expectations # Run from the directory the sample was designed for.
Defensive patterns
Strategy: validation
Validate before calling
from scenarios import get_sample_plugin_path
p = get_sample_plugin_path()
assert p is not None and Path(p).exists(), f'Sample plugin path missing: {p}' Try / catch
try:
kernel = configure_kernel()
except FileNotFoundError as e:
print('Run this sample from the repository sample directory:', e)
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- AI service not recognized.
- Plugin creation failed for {pluginName}
- Plugins directory not found. The app needs the plugins from
- Configuration key '{section}:{key}' not found
- The specified function {function.Id} is not available in the
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/21dd9b9916b8258f.
Report an issue: GitHub.