langchain-ai/deepagents · error · MarketplaceError

Git is required to add repository-backed plugin marketplaces

Error message

Git is required to add repository-backed plugin marketplaces

What it means

`_run_git` locates the `git` executable with `shutil.which` before spawning any subprocess (marketplace.py:248-252). If `git` is not on `PATH`, cloning a repository-backed marketplace cannot proceed, so it raises this `MarketplaceError`. Credential prompts are disabled (`GIT_TERMINAL_PROMPT=0`), so the library genuinely depends on a working local git installation.

Source

Thrown at libs/code/deepagents_code/plugins/marketplace.py:252

    for relative in _MARKETPLACE_RELATIVE_PATHS:
        if (
            len(path.parts) >= len(relative.parts)
            and path.parts[-len(relative.parts) :] == relative.parts
        ):
            return path.parents[len(relative.parts) - 1]
    return path.parent


def _load_marketplace_file(path: Path) -> PluginMarketplace:
    root = _root_for_marketplace_file(path.expanduser().resolve())
    return _load_marketplace_from_path(root, path.expanduser().resolve())


def _run_git(args: list[str]) -> None:
    git_path = shutil.which("git")
    if git_path is None:
        msg = "Git is required to add repository-backed plugin marketplaces"
        raise MarketplaceError(msg)
    # Inherit normal Git configuration, but disable credential prompts because
    # this subprocess has no interactive input.
    env = {
        **os.environ,
        "GIT_TERMINAL_PROMPT": "0",
        "GIT_ASKPASS": "",
    }
    try:
        result = subprocess.run(  # noqa: S603  # Fixed git executable, no shell.
            [git_path, *args],
            check=False,
            capture_output=True,
            env=env,
            text=True,
            timeout=_GIT_TIMEOUT_SECONDS,
        )
    except (OSError, subprocess.TimeoutExpired) as exc:
        msg = f"Failed to run git: {redact_urls_in_text(str(exc))}"

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Install git (`apt-get install git`, `brew install git`, `winget install Git.Git`, etc.).
  2. Ensure the git binary is on the PATH of the process running deepagents-code (`which git` to verify).
  3. In containers/CI, add git to the image or install it in the job setup step before running the add command.
  4. Alternatively, register the marketplace via a direct `https://.../marketplace.json` URL or local path, which does not require git.

Example fix

// before (slim Docker image)
FROM python:3.12-slim
RUN pip install deepagents-code
// after
FROM python:3.12-slim
RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
RUN pip install deepagents-code
Defensive patterns

Strategy: validation

Validate before calling

import shutil

def require_git() -> None:
    if shutil.which("git") is None:
        raise RuntimeError("git is not installed or not on PATH; install git before adding repository marketplaces")

Type guard

import shutil

def has_git() -> bool:
    return shutil.which("git") is not None

Try / catch

try:
    source = add_marketplace_source(repo_source)
except MarketplaceError as exc:
    if "Git is required" in str(exc):
        raise RuntimeError(
            "Install git (apt/brew/winget) and ensure it is on PATH, or use an https marketplace.json URL / local path instead"
        ) from exc
    raise

Prevention

When it happens

Trigger: Calling `add_marketplace_source` with a repository source (`owner/repo`, SSH Git URL, or `https://...*.git`) on a machine where `git` is not installed or not on `PATH`; a stripped-down container/CI image lacking git; a broken PATH in the process environment.

Common situations: Minimal Docker images (e.g. slim Python images) without git; Windows environments where git was installed but not added to PATH; virtualenv/CI runners with restricted PATH; NixOS or sandboxed shells missing git in the environment.

Related errors


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