#1126·hunk

Windows ARM64: hunk crashes instantly (bun:ffi dlopen unavailable, TinyCC disabled)

Author: iappwebdevCreated Sep 25, 2026Updated Sep 25, 2026

What happened?

On Windows 11 ARM64 (e.g. Snapdragon X Elite devices), hunk crashes immediately on every invocation that reaches the render path (hunk diff, hunk show, etc.). No hunkdiff-windows-arm64 prebuilt package exists in optionalDependencies (only hunkdiff-windows-x64 is published), so bin/hunk.cjs's findInstalledBinary() never finds a native hunk.exe and falls through to the bundled-Bun fallback (bunBinary → dist/npm/main.js). That fallback then fails during OpenTUI init:

hunk: Failed to initialize OpenTUI render library: bun:ffi dlopen() is not available in this build (TinyCC is disabled)

The process exits with status 1 within ~100-200ms. When hunk is launched from an embedding tool that opens it in its own pane/terminal (e.g. the herdr-hunk-diff plugin), this is especially confusing: the pane opens and closes again immediately, with no time to read the stderr line before the host closes it.

Verified with both [email protected] (bundled by the herdr plugin) and [email protected] (npm i -g hunkdiff) — both affected identically.

Root cause

This isn't a hunk-specific bug so much as a Bun/TinyCC platform gap: Bun explicitly disables bun:ffi on WIN32 && aarch64 (DEFAULT_ENABLE_TINYCC OFF), tracked upstream at oven-sh/bun#28055. There's in-progress work to add TinyCC ARM64 support (oven-sh/tinycc#2), but it isn't in a released Bun yet.

Other tools built on the same OpenTUI+Bun stack hit the exact same error message and have open issues tracking it:

  • anomalyco/opencode#19130, #38520, #45875, #20767
  • Kilo-Org/kilocode#10541

None of those are hunk-specific fixes, but they confirm this is a shared, currently-unresolved platform limitation rather than something local to one install.

Steps to reproduce

  1. On a Windows 11 ARM64 machine, npm i -g hunkdiff (or install via the herdr-hunk-diff plugin, which bundles it locally).
  2. In any git repo with a working-tree diff, run hunk diff.
  3. Process exits immediately with the OpenTUI/bun:ffi error above (exit code 1).

Expected behavior

Either:

  • A native hunkdiff-windows-arm64 prebuilt (once upstream Bun/TinyCC support lands), or
  • At minimum, a clearer failure than a near-instant silent crash — e.g. detect win32/arm64 up front and print an actionable "not supported yet on Windows ARM64, tracking: oven-sh/bun#28055" message before attempting the Bun fallback, so tools that embed hunk in a pane/terminal (which close on non-zero exit) don't just flash and vanish.

Version

  • hunkdiff 0.20.1 and 0.22.0 (both affected)
  • Windows 11, ARM64 (Snapdragon X Elite)
  • Node v22.14.0, Bun 1.3.14 (bundled)