{"record":{"id":"c3bdd16ecae3c448","repo":"usestrix/strix","slug":"git-executable-not-found-in-path","errorCode":null,"errorMessage":"Git executable not found in PATH","messagePattern":"Git executable not found in PATH","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"strix/interface/utils.py","lineNumber":1539,"sourceCode":"        used.add(name)\n        shutil.copy2(source, staging / name)\n        details[\"workspace_path\"] = f\"/workspace/{API_SPEC_WORKSPACE_SUBDIR}/{name}\"\n\n    return [\n        {\n            \"source_path\": str(staging),\n            \"workspace_subdir\": API_SPEC_WORKSPACE_SUBDIR,\n            \"protect_metadata\": False,\n        }\n    ]\n\n\ndef clone_repository(repo_url: str, run_name: str, dest_name: str | None = None) -> str:\n    console = Console()\n\n    git_executable = shutil.which(\"git\")\n    if git_executable is None:\n        raise FileNotFoundError(\"Git executable not found in PATH\")\n\n    temp_dir = Path(tempfile.gettempdir()) / \"strix_repos\" / run_name\n    temp_dir.mkdir(parents=True, exist_ok=True)\n\n    if dest_name:\n        repo_name = dest_name\n    else:\n        repo_name = Path(repo_url).stem if repo_url.endswith(\".git\") else Path(repo_url).name\n\n    clone_path = temp_dir / repo_name\n\n    if clone_path.exists():\n        shutil.rmtree(clone_path)\n\n    try:\n        with console.status(f\"[bold cyan]Cloning repository {repo_url}...\", spinner=\"dots\"):\n            subprocess.run(  # noqa: S603\n                [","sourceCodeStart":1521,"sourceCodeEnd":1557,"githubUrl":"https://github.com/usestrix/strix/blob/85513391305171ecc6faffe03da4a8bda5e3febb/strix/interface/utils.py#L1521-L1557","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Install git: apt-get install -y git (Debian/Alpine: apk add git), or brew install git on macOS.","If git is installed but not found, fix PATH so the git binary's directory is included.","In Dockerfiles for automation around Strix, add git to the installed packages."],"exampleFix":"# Dockerfile - before\nFROM python:3.12-slim\n\n# Dockerfile - after\nFROM python:3.12-slim\nRUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*","handlingStrategy":"validation","validationCode":"import shutil\n\nif shutil.which(\"git\") is None:\n    raise SystemExit(\"git not found in PATH; install Git (apt-get install git / apk add git / brew install git)\")","typeGuard":null,"tryCatchPattern":"try:\n    clone_path = clone_repository(repo_url, run_name)\nexcept FileNotFoundError as e:\n    raise SystemExit(\"Install Git and ensure it is on PATH before scanning repositories.\") from e","preventionTips":["Add git to CI container images explicitly","Run `git --version` as a smoke test before long scan jobs"],"tags":["git","environment","dependencies","ci"],"backgroundTag":null,"analyzedSha":"85513391305171ecc6faffe03da4a8bda5e3febb","analyzedAt":"2026-08-15T05:03:57.275Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}