unslothai/unsloth · error · RuntimeError

Could not install the pinned {source_name} source: {detail}

Error message

Could not install the pinned {source_name} source: {detail}

What it means

Raised by _git() when the git subprocess exits nonzero (CalledProcessError) — the git operation itself failed (auth, bad ref, disk full, corrupt cache). The handler extracts stderr or stdout as detail and appends it to 'Could not install the pinned {source_name} source', so the message carries git's own error text; if no output was captured, the bare message is raised.

Source

Thrown at studio/backend/utils/third_party_source.py:141

        return subprocess.run(
            ["git", *_GIT_LONG_PATHS, *arguments],
            check = True,
            capture_output = True,
            text = True,
            encoding = "utf-8",
            errors = "replace",
            timeout = 300,
            env = env,
            **_windows_hidden_subprocess_kwargs(),
        )
    except FileNotFoundError as error:
        raise RuntimeError(f"Git is required to install the pinned {source_name} source") from error
    except subprocess.TimeoutExpired as error:
        raise RuntimeError(f"Timed out while installing the pinned {source_name} source") from error
    except subprocess.CalledProcessError as error:
        detail = (error.stderr or error.stdout or "").strip()
        message = f"Could not install the pinned {source_name} source"
        raise RuntimeError(f"{message}: {detail}" if detail else message) from error


def _git_bytes(
    arguments: list[str], *, source_name: str, input_data: bytes
) -> subprocess.CompletedProcess:
    env = child_env_without_native_path_secret()
    env["GIT_TERMINAL_PROMPT"] = "0"
    env["GIT_LFS_SKIP_SMUDGE"] = "1"
    env["GIT_NO_REPLACE_OBJECTS"] = "1"
    try:
        return subprocess.run(
            ["git", *_GIT_LONG_PATHS, *arguments],
            check = True,
            capture_output = True,
            input = input_data,
            timeout = 300,
            env = env,
            **_windows_hidden_subprocess_kwargs(),

View on GitHub (pinned to 203007d190)

Solutions

  1. Read the detail suffix — it is git's stderr and names the exact failure.
  2. If the cache is corrupt or stale, delete the pinned source's cached clone directory and retry so it re-clones.
  3. If the remote is private or the ref vanished, verify the pin (source_name's URL/tag) is still fetchable: run the same git fetch/clone manually.
  4. Free disk space / fix permissions on the cache root if the detail says so.
Defensive patterns

Strategy: try-catch

Validate before calling

def pinned_source_cache_ok(cache_dir: Path) -> bool:
    if not cache_dir.exists():
        return True  # fresh clone will happen
    r = subprocess.run(['git', '-C', str(cache_dir), 'fsck', '--no-progress'],
                       capture_output=True, text=True)
    return r.returncode == 0

Try / catch

try:
    install_pinned_source(source)
except RuntimeError as e:
    msg = str(e)
    if 'Could not install the pinned' in msg:
        detail = msg.split(':', 1)[-1].strip()
        if 'fatal:' in detail or 'error:' in detail:
            log.error('git failure: %s', detail)  # act on git's own message
        if cache_dir.exists() and not pinned_source_cache_ok(cache_dir):
            shutil.rmtree(cache_dir)
            install_pinned_source(source)  # re-clone fixes corrupt cache
    else:
        raise

Prevention

When it happens

Trigger: Any failing git invocation during pinned-source install: checkout of a tag that no longer exists upstream, permission denied on the cache directory, HTTP 404/403 fetching from a restricted remote, corrupt object database in a partially-cloned cache, or a replaced ref (GIT_NO_REPLACE_OBJECTS=1 is forced, so replace refs fail).

Common situations: Pinned tag/commit deleted or repo made private upstream; stale/corrupted local clone cache from an interrupted earlier install; disk full; credential prompts disabled (GIT_TERMINAL_PROMPT=0) on a repo requiring auth.

Related errors


AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15). Data as JSON: /api/errors/368797f13d204157. Report an issue: GitHub.