langchain-ai/deepagents · error

Failed to install {args.plugin_id}: {exc}

Error message

Failed to install {args.plugin_id}: {exc}

What it means

execute_plugin_command catches MarketplaceError, FileNotFoundError, OSError, and ValueError raised by install_plugin and converts them into this human-readable CLI message, prints it, and exits with status 1. It is the top-level error surface for `deepagents-code plugin install`, so the embedded {exc} text carries the underlying cause (marketplace resolution failure, manifest error, copy error, etc.). It is an intentional controlled failure path, not a crash.

Source

Thrown at libs/code/deepagents_code/plugins/commands_cli.py:143

            write_json("plugin list", rows)
            return None
        if not rows:
            text = "No plugin marketplaces configured."
        else:
            lines = []
            for row in rows:
                status = "enabled" if row["enabled"] else "disabled"
                lines.append(f"{status} {row['id']} {row['description']}".rstrip())
            text = "\n".join(lines)
        print(text)  # noqa: T201
        return text
    if command == "install":
        try:
            instance = install_plugin(args.plugin_id)
        except (MarketplaceError, FileNotFoundError, OSError, ValueError) as exc:
            text = f"Failed to install {args.plugin_id}: {exc}"
            print(text)  # noqa: T201
            raise SystemExit(1) from exc
        details = ""
        if instance.version is not None:
            details = f" (version: {instance.version})"
        text = (
            f"Installed plugin {instance.plugin_id}{details}. Run /reload to activate."
        )
        print(text)  # noqa: T201
        return text
    if command == "uninstall":
        uninstall_plugin(args.plugin_id)
        text = f"Uninstalled plugin {args.plugin_id}."
        print(text)  # noqa: T201
        return text
    if command in {"enable", "disable"}:
        enabled = command == "enable"
        try:
            set_installed_plugin_enabled(args.plugin_id, enabled=enabled)
        except (MarketplaceError, OSError, ValueError) as exc:

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Read the embedded {exc} cause: if it names the marketplace, run `plugin marketplace list` and re-add it; if it names the manifest, fix the plugin's manifest.
  2. Verify the plugin id is `name@marketplace` and that the plugin exists in the configured marketplace.
  3. Check the cache/install directories exist and are writable by the current user.
  4. Re-add the marketplace source (e.g. `plugin marketplace add <source>`) if its location is stale.
  5. For invalid manifests, correct manifest fields (name/version) in the plugin source and retry.

Example fix

// before
$ dcode plugin install widget@internal
Failed to install widget@internal: Marketplace 'internal' is not configured
// after
$ dcode plugin marketplace add ~/markets/internal
$ dcode plugin install widget@internal
Installed plugin widget@internal (version: 1.2.0). Run /reload to activate.
Defensive patterns

Strategy: try-catch

Validate before calling

import subprocess

def plugin_installed(id_: str) -> bool:
    out = subprocess.run(["dcode", "plugin", "list"], capture_output=True, text=True)
    return id_ in out.stdout

if not plugin_installed("widget@internal") is False:
    raise SystemExit("plugin id not installed; install first")  # or proceed

Type guard

def is_valid_plugin_id(id_: str) -> bool:
    name, sep, market = id_.partition("@")
    return bool(sep) and bool(name) and bool(market)

Try / catch

import subprocess

proc = subprocess.run(["dcode", "plugin", "install", "widget@internal"], capture_output=True, text=True)
if proc.returncode == 1 and proc.stdout.startswith("Failed to install"):
    print("install failed:", proc.stdout.strip())  # inspect embedded cause and remediate

Prevention

When it happens

Trigger: Running the `plugin install <id>` CLI command when install_plugin raises MarketplaceError (plugin not in marketplace, marketplace not configured, manifest invalid, source unresolved), or when filesystem operations raise FileNotFoundError/OSError/ValueError (e.g. corrupt cache dir, permission denied).

Common situations: Typos in the plugin id or marketplace name; a marketplace added with a stale or deleted install_location; a plugin entry whose manifest fails validation; read-only or full disk during cache materialization.

Related errors


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