langchain-ai/deepagents · error
Failed to {command} {args.plugin_id}: {exc}
Error message
Failed to {command} {args.plugin_id}: {exc} What it means
execute_plugin_command catches MarketplaceError, OSError, and ValueError from set_installed_plugin_enabled for the `plugin enable`/`plugin disable` CLI commands and re-raises them as this message with exit code 1. It means the enable/disable toggle could not be applied — almost always because the plugin id is not present in the installed-plugins registry, or the registry file could not be read/written.
Source
Thrown at libs/code/deepagents_code/plugins/commands_cli.py:164
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:
text = f"Failed to {command} {args.plugin_id}: {exc}"
print(text) # noqa: T201
raise SystemExit(1) from exc
text = f"{command.title()}d plugin {args.plugin_id}."
print(text) # noqa: T201
return text
if command == "marketplace":
marketplace_command = getattr(args, "marketplace_command", None)
if marketplace_command in {"list", "ls"}:
records = load_marketplace_records()
rows = [
{
"name": record.name,
"source_type": record.source_type,
"source": redact_marketplace_source(record.source),
"install_location": (
record.install_location
if record.source_type in {"directory", "file"}
else "<managed cache>"
),
}View on GitHub (pinned to a1af029e6e)
Solutions
- Run `plugin list` (or check the installed-plugins registry) to confirm the exact plugin id.
- Fix the id spelling — the error message echoes the id with !r quoting.
- If the registry file was hand-edited, restore valid JSON or reinstall the plugin.
- Check filesystem permissions on the config directory used by the registry.
- Reinstall the plugin if it was removed but is still expected.
Example fix
// before $ dcode plugin disable widge@internal Failed to disable widge@internal: Plugin 'widge@internal' is not installed // after $ dcode plugin disable widget@internal Disabled plugin widget@internal.
Defensive patterns
Strategy: validation
Validate before calling
def can_toggle(installed_ids: list[str], plugin_id: str) -> bool:
return plugin_id in installed_ids
# before calling the CLI
if not can_toggle(installed_ids, "widget@internal"):
raise SystemExit(f"{plugin_id} is not installed; run 'plugin install' first") Type guard
def is_exact_installed_id(plugin_id: str, installed: list[str]) -> bool:
return plugin_id in installed # ids are exact strings incl. '@marketplace' Try / catch
proc = subprocess.run(["dcode", "plugin", "disable", "widget@internal"], capture_output=True, text=True)
if proc.returncode == 1 and proc.stdout.startswith("Failed to disable"):
print("toggle failed:", proc.stdout.strip()) Prevention
- Verify the id with `plugin list` before enable/disable.
- Never hand-edit the installed-plugins registry JSON.
- Install the plugin before attempting to enable it.
- Watch for plugin renames after marketplace refreshes.
- Ensure the config directory is writable.
When it happens
Trigger: Running `plugin enable <id>` or `plugin disable <id>` where set_installed_plugin_enabled raises MarketplaceError('Plugin ... is not installed') (via _require_installed_plugin), or the registry JSON is corrupt/unwritable (OSError/ValueError).
Common situations: Disabling a plugin that was already uninstalled or never installed; a typo in the plugin id; editing the installed-plugins file by hand and breaking its JSON; running the command without write permission to the config directory.
Related errors
- dcode: {message}
- Could not resolve {label} path {raw_path!r}: {exc}. Ensure t
- Error: Source agent '{source_agent}' not found or has no AGE
- enable_interpreter=True is not supported with a remote sandb
- --model-params requires a JSON object value
AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29).
Data as JSON: /api/errors/d723cce58a86d61b.
Report an issue: GitHub.