Stirling-Tools/Stirling-PDF · error · SystemExit

Unsupported platform for gitleaks: {platform.system()}/{plat

Error message

Unsupported platform for gitleaks: {platform.system()}/{platform.machine()}

What it means

SystemExit raised by install_gitleaks.platform_key when the current OS/architecture combination is not in the supported mapping. gitleaks publishes prebuilt binaries only for specific os_arch keys; an unmapped platform cannot be auto-installed.

Source

Thrown at scripts/pre-commit/install_gitleaks.py:56

IS_WINDOWS = platform.system() == "Windows"
BIN = REPO_ROOT / ".task" / "bin" / ("gitleaks.exe" if IS_WINDOWS else "gitleaks")


def platform_key() -> str:
    os_name = {"Linux": "linux", "Darwin": "darwin", "Windows": "windows"}.get(platform.system())
    arch = {
        "x86_64": "x64",
        "amd64": "x64",
        "arm64": "arm64",
        "aarch64": "arm64",
        "i386": "x32",
        "i686": "x32",
        "x86": "x32",
        "armv7l": "armv7",
        "armv6l": "armv6",
    }.get(platform.machine().lower())
    if not os_name or not arch:
        raise SystemExit(f"Unsupported platform for gitleaks: {platform.system()}/{platform.machine()}")
    return f"{os_name}_{arch}"


def cached_version() -> str | None:
    if not BIN.exists():
        return None
    try:
        return subprocess.run([str(BIN), "version"], capture_output=True, text=True).stdout.strip()
    except OSError:
        return None


def main() -> int:
    if cached_version() == VERSION:
        return 0

    key = platform_key()
    expected = SHA256.get(key)

View on GitHub (pinned to 9ef20dcab8)

Solutions

  1. Install gitleaks manually for your platform and place it on PATH, then skip the auto-installer.
  2. Add your os/arch to the mapping if gitleaks publishes a matching asset.
  3. Run on a supported platform (linux x64/arm64, macOS arm64, windows).
Defensive patterns

Strategy: validation

Validate before calling

# Check platform support before installing
import platform
key = f"{platform.system().lower()}_{platform.machine().lower()}"
if key not in SUPPORTED_KEYS:
    print("Install gitleaks manually for this platform.", file=sys.stderr)

Prevention

When it happens

Trigger: Running the pre-commit gitleaks installer on an OS/arch not in the map — e.g. Solaris, FreeBSD, RISC-V, or an unusual architecture string not normalized by the dictionary.

Common situations: CI runner on an exotic architecture. A Linux distro reporting an unexpected platform.machine() string. Running on a platform gitleaks does not ship a binary for.

Related errors


AI-assisted analysis of Stirling-Tools/Stirling-PDF@9ef20dcab8 (2026-08-13). Data as JSON: /api/errors/a040d1fd6034ccfc. Report an issue: GitHub.