usestrix/strix · error · ValueError

Could not clone repository {repo_url}: {detail}

Error message

Could not clone repository {repo_url}: {detail}

What it means

Raised when the underlying `git clone` subprocess exits non-zero: subprocess.CalledProcessError is caught and re-raised as ValueError with the repo URL and stderr detail. Typical stderr causes: repository not found (404), authentication failed, no network, or the ref already checked out at the clone path.

Source

Thrown at strix/interface/utils.py:1572

    try:
        with console.status(f"[bold cyan]Cloning repository {repo_url}...", spinner="dots"):
            subprocess.run(  # noqa: S603
                [
                    git_executable,
                    "clone",
                    repo_url,
                    str(clone_path),
                ],
                capture_output=True,
                text=True,
                check=True,
            )

        return str(clone_path.absolute())

    except subprocess.CalledProcessError as e:
        detail = e.stderr if hasattr(e, "stderr") and e.stderr else str(e)
        raise ValueError(f"Could not clone repository {repo_url}: {detail}") from e
    except FileNotFoundError as e:
        raise ValueError(
            "Git is not installed or not available in PATH. "
            "Please install Git to clone repositories."
        ) from e


def check_docker_connection() -> Any:
    try:
        return docker.from_env()
    except DockerException:
        console = Console()
        error_text = Text()
        error_text.append("DOCKER NOT AVAILABLE", style="bold red")
        error_text.append("\n\n", style="white")
        error_text.append("Cannot connect to Docker daemon.\n", style="white")
        error_text.append(
            "Please ensure Docker Desktop is installed and running, and try running strix again.\n",

View on GitHub (pinned to 8551339130)

Solutions

  1. Read the {detail} portion — it is git's stderr and names the exact failure (not found, auth, timeout).
  2. For private repos, ensure credentials exist: SSH agent/key for git@ URLs, or an https URL with a token (and GIT_ASKPASS/git credential helper configured).
  3. Verify connectivity and the URL: git ls-remote <repo_url> from the same environment.
  4. Check that /tmp/strix_repos/<run_name>/<repo> from a previous run is not blocking the clone; clear stale staging dirs.

Example fix

# before
strix -n -t https://github.com/myorg/private-repo   # no creds in env

# after
git ls-remote git@github.com:myorg/private-repo.git   # confirm SSH access works
strix -n -t git@github.com:myorg/private-repo.git
Defensive patterns

Strategy: try-catch

Validate before calling

import subprocess

def can_reach_repo(repo_url: str) -> bool:
    try:
        subprocess.run(["git", "ls-remote", repo_url], check=True, capture_output=True, timeout=30)
        return True
    except (subprocess.SubprocessError, OSError):
        return False

if not can_reach_repo(repo_url):
    raise SystemExit(f"Cannot access {repo_url}: check the URL, credentials, and network")

Try / catch

try:
    clone_path = clone_repository(repo_url, run_name)
except ValueError as e:
    if "Could not clone repository" in str(e):
        detail = str(e.__cause__) if e.__cause__ else str(e)
        if "not found" in detail.lower():
            raise SystemExit(f"Repo not found: {repo_url} (check org/name)") from e
        if "authentication" in detail.lower() or "403" in detail:
            raise SystemExit(f"Auth failed for {repo_url}: configure SSH keys or a token") from e
        raise SystemExit(f"Clone failed: {detail}") from e
    raise

Prevention

When it happens

Trigger: clone_repository('https://github.com/org/nonexistent', ...) -> git exits 128 with 'repository not found'; cloning a private repo without credentials; proxy/firewall blocking github.com; DNS failure.

Common situations: Typo in the org/repo name; targeting a private repo in CI without an SSH key or token; corporate proxies rejecting git traffic; internet-down air-gapped environments.

Related errors


AI-assisted analysis of usestrix/strix@8551339130 (2026-08-15). Data as JSON: /api/errors/6cf8bc9b90843fef. Report an issue: GitHub.