{"record":{"id":"bad25c086e148394","repo":"unslothai/unsloth","slug":"git-is-required-to-install-the-pinned-source-name","errorCode":null,"errorMessage":"Git is required to install the pinned {source_name} source","messagePattern":"Git is required to install the pinned (.+?) source","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"studio/backend/utils/third_party_source.py","lineNumber":135,"sourceCode":"def _git(arguments: list[str], *, source_name: str) -> subprocess.CompletedProcess:\n    env = child_env_without_native_path_secret()\n    env[\"GIT_TERMINAL_PROMPT\"] = \"0\"\n    env[\"GIT_LFS_SKIP_SMUDGE\"] = \"1\"\n    env[\"GIT_NO_REPLACE_OBJECTS\"] = \"1\"\n    try:\n        return subprocess.run(\n            [\"git\", *_GIT_LONG_PATHS, *arguments],\n            check = True,\n            capture_output = True,\n            text = True,\n            encoding = \"utf-8\",\n            errors = \"replace\",\n            timeout = 300,\n            env = env,\n            **_windows_hidden_subprocess_kwargs(),\n        )\n    except FileNotFoundError as error:\n        raise RuntimeError(f\"Git is required to install the pinned {source_name} source\") from error\n    except subprocess.TimeoutExpired as error:\n        raise RuntimeError(f\"Timed out while installing the pinned {source_name} source\") from error\n    except subprocess.CalledProcessError as error:\n        detail = (error.stderr or error.stdout or \"\").strip()\n        message = f\"Could not install the pinned {source_name} source\"\n        raise RuntimeError(f\"{message}: {detail}\" if detail else message) from error\n\n\ndef _git_bytes(\n    arguments: list[str], *, source_name: str, input_data: bytes\n) -> subprocess.CompletedProcess:\n    env = child_env_without_native_path_secret()\n    env[\"GIT_TERMINAL_PROMPT\"] = \"0\"\n    env[\"GIT_LFS_SKIP_SMUDGE\"] = \"1\"\n    env[\"GIT_NO_REPLACE_OBJECTS\"] = \"1\"\n    try:\n        return subprocess.run(\n            [\"git\", *_GIT_LONG_PATHS, *arguments],","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/utils/third_party_source.py#L117-L153","documentation":"Raised by _git() in the pinned third-party source installer when the 'git' executable is not found (subprocess raises FileNotFoundError). The installer clones/fetches pinned sources via git with a 300s timeout and prompts disabled; without git on PATH the install cannot proceed, so the FileNotFoundError is wrapped into this RuntimeError naming the source being installed.","triggerScenarios":"Any pinned-source install (clone/fetch/checkout of a third_party source) on a machine where 'git' is not on PATH — fresh OS, minimal container, or a GUI-launched app whose environment lacks the shell's PATH entries.","commonSituations":"Server/docker images built without git; macOS app bundles launched from Finder inheriting a minimal PATH; Windows where Git was installed but not added to PATH; CI runners on a slim base image.","solutions":["Install git (apt install git / brew install git / Git for Windows) and ensure it is on the PATH the studio process sees.","For GUI launches, start the app from a shell or configure the launcher's environment so /usr/bin or the git install dir is on PATH.","Verify with 'git --version' in the same environment the backend runs under, then retry the install."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import shutil\n\nif shutil.which('git') is None:\n    raise EnvironmentError('git not found on PATH; install it before installing pinned sources')","typeGuard":"def git_available() -> bool:\n    import shutil\n    return shutil.which('git') is not None","tryCatchPattern":"try:\n    install_pinned_source(source)\nexcept RuntimeError as e:\n    if str(e).startswith('Git is required'):\n        abort(503, 'git is not installed; install git and retry')\n    raise","preventionTips":["Include git in deployment images and setup scripts — the pinned-source installer hard-requires it.","For GUI launches, verify the process PATH contains git (launch from a shell or fix the launcher env)."],"tags":["git","environment","dependency-install","subprocess","python"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}