langchain-ai/deepagents · error · ValueError

Entry point {entry.name!r} does not resolve to a Python modu

Error message

Entry point {entry.name!r} does not resolve to a Python module

What it means

Raised by _entry_point_source in discovery when an extension entry point's module portion cannot be located via importlib.util.find_spec — either the module does not exist or has no resolvable file origin. It is surfaced as ValueError while enumerating entry-point sources for extension discovery.

Source

Thrown at libs/code/deepagents_code/extensions/discovery.py:125

        SourceInfo(
            _canonical(path),
            is_package=path.name == "__init__.py",
            source_id=plugin.plugin_id,
            version=plugin.version,
            installed_root=_canonical(plugin.root),
        )
        for plugin in plugins
        if plugin.manifest is not None
        for path in plugin.manifest.python_extensions
    ]


def _entry_point_source(entry: importlib.metadata.EntryPoint) -> SourceInfo:
    module = entry.value.partition(":")[0]
    spec = importlib.util.find_spec(module)
    if spec is None or spec.origin is None:
        msg = f"Entry point {entry.name!r} does not resolve to a Python module"
        raise ValueError(msg)
    version = entry.dist.version if entry.dist is not None else None
    return SourceInfo(
        _canonical(Path(spec.origin)),
        is_package=spec.submodule_search_locations is not None,
        source_id=f"{entry.name}@entry-point",
        version=version,
        installed_root=_canonical(Path(spec.origin).parent),
    )


def _entry_point_sources() -> DiscoveryResult:
    sources: list[SourceInfo] = []
    errors: list[str] = []
    try:
        entries = sorted(
            importlib.metadata.entry_points(group=ENTRY_POINT_GROUP),
            key=lambda entry: (entry.name, entry.value),
        )

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Reinstall the package providing the entry point (pip install --force-reinstall <pkg>) so code and metadata match
  2. Check the entry point value in the package metadata and correct it to an existing module:obj path
  3. Verify `python -c "import <module>"` works in the same environment the agent runs in
  4. Remove or upgrade stale plugin packages that declare dead entry points
  5. If you authored the entry point, ensure it points to a real file-backed module, not a namespace package

Example fix

// before (pyproject)
[project.entry-points.deepagents_extensions]
myext = "myext_plugin.ext:new_ext"  # module deleted

// after
[project.entry-points.deepagents_extensions]
myext = "myext.extensions:new_ext"
Defensive patterns

Strategy: try-catch

Validate before calling

import importlib.util, importlib.metadata

def entry_point_ok(entry) -> bool:
    module = entry.value.partition(":")[0]
    try:
        spec = importlib.util.find_spec(module)
    except (ImportError, ValueError, ModuleNotFoundError):
        return False
    return spec is not None and spec.origin is not None

Type guard

def resolves_to_module(entry) -> bool:
    module = entry.value.partition(":")[0]
    spec = importlib.util.find_spec(module)
    return spec is not None and spec.origin is not None

Try / catch

try:
    sources = discover_extensions()
except ValueError as exc:
    logger.warning("skipping bad extension entry point: %s", exc)

Prevention

When it happens

Trigger: A package declares an extension entry point whose value references a module that is not installed/importable, or whose module resolves to a namespace package or other spec without `origin` (no file on disk).

Common situations: Installed a plugin package version whose entry points changed; the entry-point target module was renamed or removed; broken/partial install (metadata present but code missing); editable installs with stale metadata; namespace packages without __init__.py.

Related errors


AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29). Data as JSON: /api/errors/aa06934b96cdfcb9. Report an issue: GitHub.