{"record":{"id":"a040d1fd6034ccfc","repo":"Stirling-Tools/Stirling-PDF","slug":"unsupported-platform-for-gitleaks-platform-syste","errorCode":null,"errorMessage":"Unsupported platform for gitleaks: {platform.system()}/{platform.machine()}","messagePattern":"Unsupported platform for gitleaks: (.+?)/(.+?)","errorType":"exception","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"scripts/pre-commit/install_gitleaks.py","lineNumber":56,"sourceCode":"IS_WINDOWS = platform.system() == \"Windows\"\nBIN = REPO_ROOT / \".task\" / \"bin\" / (\"gitleaks.exe\" if IS_WINDOWS else \"gitleaks\")\n\n\ndef platform_key() -> str:\n    os_name = {\"Linux\": \"linux\", \"Darwin\": \"darwin\", \"Windows\": \"windows\"}.get(platform.system())\n    arch = {\n        \"x86_64\": \"x64\",\n        \"amd64\": \"x64\",\n        \"arm64\": \"arm64\",\n        \"aarch64\": \"arm64\",\n        \"i386\": \"x32\",\n        \"i686\": \"x32\",\n        \"x86\": \"x32\",\n        \"armv7l\": \"armv7\",\n        \"armv6l\": \"armv6\",\n    }.get(platform.machine().lower())\n    if not os_name or not arch:\n        raise SystemExit(f\"Unsupported platform for gitleaks: {platform.system()}/{platform.machine()}\")\n    return f\"{os_name}_{arch}\"\n\n\ndef cached_version() -> str | None:\n    if not BIN.exists():\n        return None\n    try:\n        return subprocess.run([str(BIN), \"version\"], capture_output=True, text=True).stdout.strip()\n    except OSError:\n        return None\n\n\ndef main() -> int:\n    if cached_version() == VERSION:\n        return 0\n\n    key = platform_key()\n    expected = SHA256.get(key)","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/Stirling-Tools/Stirling-PDF/blob/9ef20dcab80b85041912f045e17a6aea1d08f969/scripts/pre-commit/install_gitleaks.py#L38-L74","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Install gitleaks manually for your platform and place it on PATH, then skip the auto-installer.","Add your os/arch to the mapping if gitleaks publishes a matching asset.","Run on a supported platform (linux x64/arm64, macOS arm64, windows)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# Check platform support before installing\nimport platform\nkey = f\"{platform.system().lower()}_{platform.machine().lower()}\"\nif key not in SUPPORTED_KEYS:\n    print(\"Install gitleaks manually for this platform.\", file=sys.stderr)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run the installer only on supported platforms (linux/macOS/windows x64/arm64).","Install gitleaks manually on exotic platforms and place it on PATH.","Extend the mapping only when a matching official asset exists."],"tags":["pre-commit","platform","dependencies","python","gitleaks"],"backgroundTag":null,"analyzedSha":"9ef20dcab80b85041912f045e17a6aea1d08f969","analyzedAt":"2026-08-13T22:11:39.827Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}