dotnet/runtime · error · RuntimeError

Unable to find MinGit asset for arch '{arch}'. Available ass

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 when no asset in the latest git-for-windows GitHub release matches the regex `^MinGit-.*-(32-bit|64-bit|arm64)\.zip$` for the detected arch. This is a Windows-Helix workaround to give crank a git binary.

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 290d5ab72c)

Solutions

  1. Pre-install git on the Helix image so shutil.which('git') succeeds and this path is skipped.
  2. Pin to a git-for-windows release tag that ships the needed arch asset (e.g. an arm64-capable release).
  3. Update the regex / m mapping in ensure_git to match the current asset naming.
  4. Handle GitHub API rate-limiting (check response for 'message':'API rate limit').

Example fix

// before
# arch=arm64, release has no arm64 MinGit -> raises [191]
// after
# pre-stage MinGit on the image, or loosen the matcher:
asset = next((a for a in assets if 'MinGit' in a['name']), None)
if asset is None: raise RuntimeError('no MinGit asset at all')
Defensive patterns

Strategy: fallback

Validate before calling

import shutil
if shutil.which('git') is None and sys.platform == 'win32':
    assets = requests.get('https://api.github.com/repos/git-for-windows/git/releases/latest', timeout=100).json().get('assets', [])
    names = [a['name'] for a in assets if 'MinGit' in a['name']]
    if not any(('arm64' in n) for n in names) and arch == 'arm64':
        raise SystemExit('no arm64 MinGit in latest release; pre-stage git or pin a release')

Type guard

def mingit_asset_exists(arch: str, assets: list) -> bool:
    import re
    rx = re.compile(r'^MinGit-.*-(32-bit|64-bit|arm64)\.zip$', re.I)
    m = {'x64':'64-bit','arm64':'arm64','x86':'32-bit'}
    return any(rx.match(a['name']) and m.get(arch,'') in a['name'] for a in assets)

Try / catch

try:
    ensure_git(tools_dir)
except RuntimeError as e:
    if 'MinGit asset' in str(e):
        preinstall_git_on_image(); ensure_git(tools_dir)

Prevention

When it happens

Trigger: `shutil.which('git')` is None on win32, the GitHub releases API returns assets, but none match MinGit for {x64:'64-bit', arm64:'arm64', x86:'32-bit'} mapping (e.g. release naming changed, or a new arch like arm64 was detected but no arm64 MinGit exists).

Common situations: Git-for-windows release ships no arm64 MinGit (historically true for some releases); release tag naming format changed; GitHub API returned partial/rate-limited asset list; platform.machine() returned an unexpected value.

Related errors


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