usestrix/strix · error · FileNotFoundError

Git executable not found in PATH

Error message

Git executable not found in PATH

What it means

clone_repository looks up the git executable with shutil.which('git') before attempting any clone; if git is not on PATH it raises FileNotFoundError immediately. This gives a precise 'install git' signal instead of a confusing per-clone failure, and it is raised before any temp staging directory is created.

Source

Thrown at strix/interface/utils.py:1539

        used.add(name)
        shutil.copy2(source, staging / name)
        details["workspace_path"] = f"/workspace/{API_SPEC_WORKSPACE_SUBDIR}/{name}"

    return [
        {
            "source_path": str(staging),
            "workspace_subdir": API_SPEC_WORKSPACE_SUBDIR,
            "protect_metadata": False,
        }
    ]


def clone_repository(repo_url: str, run_name: str, dest_name: str | None = None) -> str:
    console = Console()

    git_executable = shutil.which("git")
    if git_executable is None:
        raise FileNotFoundError("Git executable not found in PATH")

    temp_dir = Path(tempfile.gettempdir()) / "strix_repos" / run_name
    temp_dir.mkdir(parents=True, exist_ok=True)

    if dest_name:
        repo_name = dest_name
    else:
        repo_name = Path(repo_url).stem if repo_url.endswith(".git") else Path(repo_url).name

    clone_path = temp_dir / repo_name

    if clone_path.exists():
        shutil.rmtree(clone_path)

    try:
        with console.status(f"[bold cyan]Cloning repository {repo_url}...", spinner="dots"):
            subprocess.run(  # noqa: S603
                [

View on GitHub (pinned to 8551339130)

Solutions

  1. Install git: apt-get install -y git (Debian/Alpine: apk add git), or brew install git on macOS.
  2. If git is installed but not found, fix PATH so the git binary's directory is included.
  3. In Dockerfiles for automation around Strix, add git to the installed packages.

Example fix

# Dockerfile - before
FROM python:3.12-slim

# Dockerfile - after
FROM python:3.12-slim
RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
Defensive patterns

Strategy: validation

Validate before calling

import shutil

if shutil.which("git") is None:
    raise SystemExit("git not found in PATH; install Git (apt-get install git / apk add git / brew install git)")

Try / catch

try:
    clone_path = clone_repository(repo_url, run_name)
except FileNotFoundError as e:
    raise SystemExit("Install Git and ensure it is on PATH before scanning repositories.") from e

Prevention

When it happens

Trigger: clone_repository() called in an environment where git is not installed or not on PATH: minimal Docker images (alpine, distroless), slim CI containers, or a mangled PATH environment variable.

Common situations: CI runners based on python:slim or alpine without git installed; cron jobs with a minimal PATH; locally after moving git or using a broken version manager.

Related errors


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