{"record":{"id":"80c425be8479868e","repo":"usestrix/strix","slug":"git-is-not-installed-or-not-available-in-path-ple","errorCode":null,"errorMessage":"Git is not installed or not available in PATH. Please install Git to clone repositories.","messagePattern":"Git is not installed or not available in PATH\\. Please install Git to clone repositories\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"strix/interface/utils.py","lineNumber":1574,"sourceCode":"            subprocess.run(  # noqa: S603\n                [\n                    git_executable,\n                    \"clone\",\n                    repo_url,\n                    str(clone_path),\n                ],\n                capture_output=True,\n                text=True,\n                check=True,\n            )\n\n        return str(clone_path.absolute())\n\n    except subprocess.CalledProcessError as e:\n        detail = e.stderr if hasattr(e, \"stderr\") and e.stderr else str(e)\n        raise ValueError(f\"Could not clone repository {repo_url}: {detail}\") from e\n    except FileNotFoundError as e:\n        raise ValueError(\n            \"Git is not installed or not available in PATH. \"\n            \"Please install Git to clone repositories.\"\n        ) from e\n\n\ndef check_docker_connection() -> Any:\n    try:\n        return docker.from_env()\n    except DockerException:\n        console = Console()\n        error_text = Text()\n        error_text.append(\"DOCKER NOT AVAILABLE\", style=\"bold red\")\n        error_text.append(\"\\n\\n\", style=\"white\")\n        error_text.append(\"Cannot connect to Docker daemon.\\n\", style=\"white\")\n        error_text.append(\n            \"Please ensure Docker Desktop is installed and running, and try running strix again.\\n\",\n            style=\"white\",\n        )","sourceCodeStart":1556,"sourceCodeEnd":1592,"githubUrl":"https://github.com/usestrix/strix/blob/85513391305171ecc6faffe03da4a8bda5e3febb/strix/interface/utils.py#L1556-L1592","documentation":"The FileNotFoundError branch of the clone subprocess: the git binary itself could not be executed (which() may have passed earlier if PATH changed, or the clone ran in a different context). It is converted to a friendlier ValueError telling the user to install Git, chained from the original error.","triggerScenarios":"subprocess.run(['git', ...]) inside clone_repository raising FileNotFoundError — e.g. PATH was modified between the which() check and the clone, or the git shim points at a removed binary.","commonSituations":"Virtualenv activation scripts or docker exec altering PATH mid-run; git uninstalled while a session was open; Windows Git Bash shims broken after an update.","solutions":["Install Git or repair its installation (apt/apk/brew/installer), then restart the shell or CI job so PATH refreshes.","Confirm `git --version` works in the exact environment that runs strix.","Avoid mutating PATH between processes; pass a stable environment to the scan."],"exampleFix":"# CI - before\njobs: {scan: {runs-on: ubuntu-latest, steps: [{run: strix -n -t $REPO}]}}  # container without git\n\n# CI - after - use a job/container image that includes git\ncontainer: {image: 'python:3.12'}\nsteps:\n  - run: apt-get update && apt-get install -y git\n  - run: strix -n -t $REPO","handlingStrategy":"validation","validationCode":"import shutil\n\nif shutil.which(\"git\") is None:\n    raise SystemExit(\"Git missing: install it and ensure `git --version` works in this environment\")","typeGuard":null,"tryCatchPattern":"try:\n    clone_path = clone_repository(repo_url, run_name)\nexcept ValueError as e:\n    if \"Git is not installed\" in str(e):\n        raise SystemExit(\"Install Git (and restart the shell/CI job so PATH refreshes) then retry.\") from e\n    raise","preventionTips":["Restart shells/CI jobs after installing or moving git so PATH is fresh","Pin a base image that includes git for automation jobs"],"tags":["git","environment","dependencies","clone"],"backgroundTag":null,"analyzedSha":"85513391305171ecc6faffe03da4a8bda5e3febb","analyzedAt":"2026-08-15T05:03:57.275Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}