langchain-ai/deepagents · error · MarketplaceError

Git command failed: {redact_urls_in_text(detail)}

Error message

Git command failed: {redact_urls_in_text(detail)}

What it means

When the git subprocess exits with a non-zero return code, `_run_git` raises this `MarketplaceError` containing git's stderr (or stdout, or `unknown git error`), passed through `redact_urls_in_text` to mask any HTTP credentials in the remote URL (marketplace.py:272-275). This is git itself reporting failure — e.g. clone, fetch, or checkout failed — surfaced verbatim so the underlying git diagnostic is visible.

Source

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

        "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))}"
        raise MarketplaceError(msg) from exc
    if result.returncode != 0:
        detail = result.stderr.strip() or result.stdout.strip() or "unknown git error"
        msg = f"Git command failed: {redact_urls_in_text(detail)}"
        raise MarketplaceError(msg)


def _clone_repository_to_cache(
    source: RepositoryMarketplaceSource,
    git_url: str,
    *,
    cache_key: str,
    validate: Callable[[Path], None] | None = None,
) -> Path:
    cache_path = ensure_marketplace_cache_dir() / (
        f"repository-{opaque_cache_key(cache_key)}"
    )
    temp_path = Path(
        tempfile.mkdtemp(prefix=f".{cache_path.name}.", dir=cache_path.parent)
    )
    args = ["clone", "--depth", "1", "--recurse-submodules", "--shallow-submodules"]
    if source.ref:
        args.extend(["--branch", source.ref])

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Read the git detail in the error message — it names the actual git failure (auth, not found, network, etc.).
  2. Verify the repository exists and you have access: `git ls-remote <url>` (set up SSH keys or a credential helper for private repos).
  3. Check network/proxy reachability to the Git host; configure `http_proxy`/`https_proxy` if behind a corporate proxy.
  4. Confirm the `#ref` (branch/tag) in the source string exists in the repository.
  5. Retry if the failure was transient (DNS blip, rate limit).

Example fix

// before (private repo, no credentials configured)
add_marketplace_source("owner/private-marketplace")
// after
ssh-keygen -t ed25519 && # add key to GitHub
# or: git config --global credential.helper store
add_marketplace_source("owner/private-marketplace")
Defensive patterns

Strategy: try-catch

Validate before calling

import subprocess

def can_reach_repo(git_url: str) -> bool:
    proc = subprocess.run(
        ["git", "ls-remote", git_url, "HEAD"],
        capture_output=True, text=True, timeout=60,
        env={**__import__('os').environ, "GIT_TERMINAL_PROMPT": "0"},
    )
    if proc.returncode != 0:
        raise RuntimeError(f"Cannot access {git_url}: {proc.stderr.strip()}")
    return True

Type guard

null

Try / catch

try:
    add_marketplace_source(repo_source)
except MarketplaceError as exc:
    if str(exc).startswith("Git command failed"):
        detail = str(exc)
        if "Authentication" in detail or "403" in detail:
            raise RuntimeError("Configure SSH keys or a credential helper for this private repo") from exc
        if "not found" in detail or "404" in detail:
            raise RuntimeError("Repository does not exist or you lack access — verify owner/repo") from exc
        # network/ref errors: surface git's own diagnostic to the user
        raise RuntimeError(detail) from exc
    raise

Prevention

When it happens

Trigger: `_clone_repository_to_cache` calls `_run_git(['clone', ...])` (or fetch/reset) and git exits non-zero: nonexistent repository (404 from GitHub), authentication failure (private repo without credentials/SSH key), network unreachable/DNS failure, invalid `#ref` (unknown branch/tag), or a full disk during checkout.

Common situations: Typo'd `owner/repo` shorthand pointing at a repo that does not exist; private marketplace repo with no SSH key or PAT configured; offline/corporate-proxy environments blocking github.com; the `#ref` suffix naming a branch that was deleted or renamed.

Related errors


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