langchain-ai/deepagents · error · FileNotFoundError
Plugin source directory not found: {source}
Error message
Plugin source directory not found: {source} What it means
FileNotFoundError raised by cache_and_register_plugin when the directory given as `source_dir` does not resolve to an existing directory on disk. The plugin must be copied from this source into the versioned plugin cache before registration, so a missing source is fatal.
Source
Thrown at libs/code/deepagents_code/plugins/store.py:510
"""Copy a plugin into the versioned cache and register the install.
Args:
plugin_id: Plugin id in `{name}@{marketplace}` form.
source_dir: Source plugin root to copy from.
version: Version declared by the plugin manifest, if any.
validate: Optional validation to run before registering the cache.
Returns:
Absolute path to the cached plugin root.
Raises:
FileNotFoundError: If `source_dir` is not an existing directory.
OSError: If the cache cannot be copied or atomically replaced.
"""
source = source_dir.resolve()
if not source.is_dir():
msg = f"Plugin source directory not found: {source}"
raise FileNotFoundError(msg)
cache_path = versioned_cache_path(plugin_id, version)
if cache_path.exists() and version is not None:
try:
if any(cache_path.iterdir()):
if validate is not None:
validate(cache_path)
add_installed_plugin(
plugin_id,
install_path=str(cache_path),
version=version,
)
return cache_path
except OSError:
pass
cache_path.parent.mkdir(parents=True, exist_ok=True)
temp_dir = cache_path.parent / f".{cache_path.name}.tmp-{os.getpid()}"View on GitHub (pinned to a1af029e6e)
Solutions
- Verify the path exists and is a directory: ls <source_dir>
- Rebuild or re-clone the plugin source before installing
- Pass an absolute path to avoid resolution surprises from the current working directory
- If the plugin ships via marketplace, install by id instead of a local source path
Example fix
// before await install_plugin(plugin_id="my-plugin", source_dir="./plugn") # typo // after await install_plugin(plugin_id="my-plugin", source_dir="/abs/path/to/my-plugin")
Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
source = Path(source_dir).resolve()
if not source.is_dir():
raise FileNotFoundError(f"plugin source is not a directory: {source}") Try / catch
try:
await install_plugin(plugin_id=p, source_dir=src)
except FileNotFoundError:
console.print(f"[red]Source {src} missing — rebuild the plugin first.[/red]") Prevention
- Pass absolute, resolved paths to install_plugin
- Build/clone the plugin source before installing and confirm with ls
- Watch for temp build dirs being garbage-collected before install
- Prefer marketplace-id installs over raw local paths when available
When it happens
Trigger: Calling install_plugin or auto_update_plugins with a `source_dir` that has been deleted, moved, was never created, or is a file rather than a directory; `source_dir.resolve()` + `is_dir()` fails before any caching begins.
Common situations: Typo in the local plugin path; building the plugin in a temp dir that was cleaned up; pointing install at a git repo root whose checkout was removed; relative path resolved from an unexpected working directory.
Related errors
- Could not find {target_name} inside {archive.name}
- Installed {plugin_id} but failed to load from cache: {detail
- Could not read plugin manifest {manifest_path}: {exc}
- Path does not exist: {path}
- Marketplace URL {_redact_url_credentials(url)} only download
AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29).
Data as JSON: /api/errors/8637e8ca45133811.
Report an issue: GitHub.