{"record":{"id":"6487eb705457293f","repo":"langchain-ai/deepagents","slug":"git-command-failed-redact-urls-in-text-detail","errorCode":null,"errorMessage":"Git command failed: {redact_urls_in_text(detail)}","messagePattern":"Git command failed: (.+?)","errorType":"exception","errorClass":"MarketplaceError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/plugins/marketplace.py","lineNumber":275,"sourceCode":"        \"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))}\"\n        raise MarketplaceError(msg) from exc\n    if result.returncode != 0:\n        detail = result.stderr.strip() or result.stdout.strip() or \"unknown git error\"\n        msg = f\"Git command failed: {redact_urls_in_text(detail)}\"\n        raise MarketplaceError(msg)\n\n\ndef _clone_repository_to_cache(\n    source: RepositoryMarketplaceSource,\n    git_url: str,\n    *,\n    cache_key: str,\n    validate: Callable[[Path], None] | None = None,\n) -> Path:\n    cache_path = ensure_marketplace_cache_dir() / (\n        f\"repository-{opaque_cache_key(cache_key)}\"\n    )\n    temp_path = Path(\n        tempfile.mkdtemp(prefix=f\".{cache_path.name}.\", dir=cache_path.parent)\n    )\n    args = [\"clone\", \"--depth\", \"1\", \"--recurse-submodules\", \"--shallow-submodules\"]\n    if source.ref:\n        args.extend([\"--branch\", source.ref])","sourceCodeStart":257,"sourceCodeEnd":293,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/plugins/marketplace.py#L257-L293","documentation":"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.","triggerScenarios":"`_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.","commonSituations":"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.","solutions":["Read the git detail in the error message — it names the actual git failure (auth, not found, network, etc.).","Verify the repository exists and you have access: `git ls-remote <url>` (set up SSH keys or a credential helper for private repos).","Check network/proxy reachability to the Git host; configure `http_proxy`/`https_proxy` if behind a corporate proxy.","Confirm the `#ref` (branch/tag) in the source string exists in the repository.","Retry if the failure was transient (DNS blip, rate limit)."],"exampleFix":"// before (private repo, no credentials configured)\nadd_marketplace_source(\"owner/private-marketplace\")\n// after\nssh-keygen -t ed25519 && # add key to GitHub\n# or: git config --global credential.helper store\nadd_marketplace_source(\"owner/private-marketplace\")","handlingStrategy":"try-catch","validationCode":"import subprocess\n\ndef can_reach_repo(git_url: str) -> bool:\n    proc = subprocess.run(\n        [\"git\", \"ls-remote\", git_url, \"HEAD\"],\n        capture_output=True, text=True, timeout=60,\n        env={**__import__('os').environ, \"GIT_TERMINAL_PROMPT\": \"0\"},\n    )\n    if proc.returncode != 0:\n        raise RuntimeError(f\"Cannot access {git_url}: {proc.stderr.strip()}\")\n    return True","typeGuard":"null","tryCatchPattern":"try:\n    add_marketplace_source(repo_source)\nexcept MarketplaceError as exc:\n    if str(exc).startswith(\"Git command failed\"):\n        detail = str(exc)\n        if \"Authentication\" in detail or \"403\" in detail:\n            raise RuntimeError(\"Configure SSH keys or a credential helper for this private repo\") from exc\n        if \"not found\" in detail or \"404\" in detail:\n            raise RuntimeError(\"Repository does not exist or you lack access — verify owner/repo\") from exc\n        # network/ref errors: surface git's own diagnostic to the user\n        raise RuntimeError(detail) from exc\n    raise","preventionTips":["Run `git ls-remote <url>` to verify access and existence before registering a repository marketplace.","Set up SSH keys or a PAT credential helper for private repos before adding them.","Verify any `#ref` branch/tag exists in the target repository.","Configure proxy env vars (`http_proxy`/`https_proxy`) in corporate networks before cloning."],"tags":["git","subprocess","authentication","network"],"backgroundTag":"git-clone-failed","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}