{"record":{"id":"37decc41e9035f4b","repo":"langchain-ai/deepagents","slug":"git-is-required-to-add-repository-backed-plugin-ma","errorCode":null,"errorMessage":"Git is required to add repository-backed plugin marketplaces","messagePattern":"Git is required to add repository-backed plugin marketplaces","errorType":"exception","errorClass":"MarketplaceError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/plugins/marketplace.py","lineNumber":252,"sourceCode":"    for relative in _MARKETPLACE_RELATIVE_PATHS:\n        if (\n            len(path.parts) >= len(relative.parts)\n            and path.parts[-len(relative.parts) :] == relative.parts\n        ):\n            return path.parents[len(relative.parts) - 1]\n    return path.parent\n\n\ndef _load_marketplace_file(path: Path) -> PluginMarketplace:\n    root = _root_for_marketplace_file(path.expanduser().resolve())\n    return _load_marketplace_from_path(root, path.expanduser().resolve())\n\n\ndef _run_git(args: list[str]) -> None:\n    git_path = shutil.which(\"git\")\n    if git_path is None:\n        msg = \"Git is required to add repository-backed plugin marketplaces\"\n        raise MarketplaceError(msg)\n    # Inherit normal Git configuration, but disable credential prompts because\n    # this subprocess has no interactive input.\n    env = {\n        **os.environ,\n        \"GIT_TERMINAL_PROMPT\": \"0\",\n        \"GIT_ASKPASS\": \"\",\n    }\n    try:\n        result = subprocess.run(  # noqa: S603  # Fixed git executable, no shell.\n            [git_path, *args],\n            check=False,\n            capture_output=True,\n            env=env,\n            text=True,\n            timeout=_GIT_TIMEOUT_SECONDS,\n        )\n    except (OSError, subprocess.TimeoutExpired) as exc:\n        msg = f\"Failed to run git: {redact_urls_in_text(str(exc))}\"","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/plugins/marketplace.py#L234-L270","documentation":"`_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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Install git (`apt-get install git`, `brew install git`, `winget install Git.Git`, etc.).","Ensure the git binary is on the PATH of the process running deepagents-code (`which git` to verify).","In containers/CI, add git to the image or install it in the job setup step before running the add command.","Alternatively, register the marketplace via a direct `https://.../marketplace.json` URL or local path, which does not require git."],"exampleFix":"// before (slim Docker image)\nFROM python:3.12-slim\nRUN pip install deepagents-code\n// after\nFROM python:3.12-slim\nRUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*\nRUN pip install deepagents-code","handlingStrategy":"validation","validationCode":"import shutil\n\ndef require_git() -> None:\n    if shutil.which(\"git\") is None:\n        raise RuntimeError(\"git is not installed or not on PATH; install git before adding repository marketplaces\")","typeGuard":"import shutil\n\ndef has_git() -> bool:\n    return shutil.which(\"git\") is not None","tryCatchPattern":"try:\n    source = add_marketplace_source(repo_source)\nexcept MarketplaceError as exc:\n    if \"Git is required\" in str(exc):\n        raise RuntimeError(\n            \"Install git (apt/brew/winget) and ensure it is on PATH, or use an https marketplace.json URL / local path instead\"\n        ) from exc\n    raise","preventionTips":["Install git in container/CI images (slim base images omit it).","Verify `which git` in the exact environment that runs deepagents-code.","Prefer `https://.../marketplace.json` or local-path sources where git is unavailable."],"tags":["git","environment","missing-dependency","subprocess"],"backgroundTag":"missing-dependency","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}