dotnet/runtime · error · RuntimeError

Unable to find MinGit asset for arch

Error message

Unable to find MinGit asset for arch '{arch}'. Available assets: {[a['name'] for a in assets if 'MinGit' in a['name']]}

What it means

Raised by ensure_git() in superpmi_aspnet2.py at src/coreclr/scripts/superpmi_aspnet2.py:99 on Windows when git is not installed and no MinGit release asset matches the detected architecture. It queries the latest git-for-windows GitHub release and matches the MinGit zip against x86/x64/arm64; a StopIteration on the asset search triggers the RuntimeError.

Solutions

  1. Pre-install git on the Windows agent and put it on PATH so shutil.which('git') short-circuits the download.
  2. Retry the job — the GitHub releases API may have returned an incomplete asset list.
  3. Confirm the latest git-for-windows release actually published a MinGit asset for your arch.
  4. Pin a known-good git-for-windows release URL instead of always querying 'latest'.
Defensive patterns

Strategy: retry

Validate before calling

if sys.platform == 'win32':
    mach = platform.machine().lower()
    arch = 'arm64' if 'arm64' in mach else ('x86' if mach in ('x86', 'i386', 'i686') else 'x64')
    if arch not in ('x86', 'x64', 'arm64'):
        raise SystemExit(f"Cannot map platform.machine() '{mach}' to a MinGit arch")

Try / catch

for attempt in range(3):
    try:
        ensure_git(tools_dir)
        break
    except RuntimeError as e:
        if 'MinGit asset' in str(e) and attempt < 2:
            time.sleep(5)
            continue
        raise

Prevention

When it happens

Trigger: Running on a Windows agent without git where platform.machine() returns a value not mapping to x86/x64/arm64, or the git-for-windows latest release has no matching MinGit asset (transient GitHub API response or release not yet published for that arch).

Common situations: Helix/CI agents with unusual machine names, incomplete GitHub API response, or a new arch label absent from the m={'x64','x86','arm64'} mapping.

Related errors


AI-assisted analysis of dotnet/runtime@60108ba66e (2026-08-10). Data as JSON: /api/errors/a08687ba0a03a84f. Report an issue: GitHub.

Appendix: source

Thrown at src/coreclr/scripts/superpmi_aspnet2.py:99

        print("git found")
        return
    if sys.platform == "win32":
        print("git not found, downloading portable git...")
        m = {"x64": "64-bit", "arm64": "arm64", "x86": "32-bit"}
        assets = requests.get(
            "https://api.github.com/repos/git-for-windows/git/releases/latest", timeout=100
        ).json()["assets"]
        rx = re.compile(r"^MinGit-.*-(32-bit|64-bit|arm64)\.zip$", re.I)
        arch = "x64"
        mach = platform.machine().lower()
        if "arm64" in mach:
            arch = "arm64"
        elif mach in ("x86", "i386", "i686"):
            arch = "x86"
        try:
            asset = next(a for a in assets if rx.match(a["name"]) and m[arch] in a["name"]) 
        except StopIteration:
            raise RuntimeError(
                f"Unable to find MinGit asset for arch '{arch}'. Available assets: "
                f"{[a['name'] for a in assets if 'MinGit' in a['name']]}"
            )
        dest_str = str(dest)
        os.makedirs(dest_str, exist_ok=True)
        zip_path = os.path.join(dest_str, asset["name"]) 
        with requests.get(asset["browser_download_url"], stream=True) as r, open(zip_path, "wb") as f:
            for c in r.iter_content(8192):
                f.write(c)
        git_dir = os.path.join(dest_str, "git")
        shutil.rmtree(git_dir, ignore_errors=True)
        with zipfile.ZipFile(zip_path) as z:
            z.extractall(git_dir)
        os.remove(zip_path)
        cmd_path = os.path.join(git_dir, "cmd")
        os.environ["PATH"] = cmd_path + os.pathsep + os.environ.get("PATH", "")
        return

View on GitHub (pinned to 60108ba66e)