Skip to content

fix Windows ARM64 TUI startup when bun:ffi is unavailable #20767

Closed

Description

@sudorest

Summary

On Windows 11 ARM64, the TUI can fail to start with:

This happens before the TUI finishes startup.

Environment

  • Windows 11 ARM64
  • Parallels Desktop
  • MacBook Pro M4 host

Expected

The TUI should still start even if Bun's FFI support is unavailable for the Windows console helper path.

Actual

The TUI exits during startup because the Windows helper eagerly imports .

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Apr 2, 2026
  2. github-actions commented on Apr 2, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Please review that issue and add any new findings there if the underlying cause or context differs.

  3. bold84 commented on Apr 7, 2026

    @bold84
    Contributor

    I added Windows ARM64 to TinyCC and created a PR:

    oven-sh/tinycc#2

    This is the bun issue...

    oven-sh/bun#28055

    Once TinyCC PR is merged, bun:ffi should be available on Windows ARM64.

  4. johnW-ret commented on Apr 15, 2026

    @johnW-ret

    @bold84 Thank you for looking into this. When do you think it will be merged? Or is there a tiny drop-in or a way to build from source people can use as a workaround in the meantime?

  5. bold84 commented on Apr 15, 2026

    @bold84
    Contributor

    I don't know when or if the maintainer will merge it

  6. Carson-yy commented on Apr 24, 2026

    @Carson-yy

    I've encountered the same problem. When will it be fixed? Or is there any way to use it? Can a lower version work?

  7. Hona commented on Apr 24, 2026

    @Hona
    Member

    No - bun doesnt work correctly on arm64.
    we will be on node soon which will fix this

  8. Billzhong2022 commented on Apr 28, 2026

    @Billzhong2022

    I've reproduced same issue. When will you fix it? Please help share ETA to us. Thanks!

  9. removed
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on May 3, 2026
  10. jcompagner commented on May 17, 2026

    @jcompagner

    the original TinyCC already seems to have at least some support for this right? looking at this: TinyCC/tinycc@30afb50

  11. ziyuei commented on Jul 7, 2026

    @ziyuei

    This also affects MiMo Code (XiaomiMiMo/MiMo-Code) which is a fork of OpenCode.
    On Windows ARM64, mimo serve works but mimo attach (TUI) fails with the same
    bun:ffi error. MiMo Code v0.1.4, Windows 11 ARM64, Snapdragon 8cx Gen 3.

  12. RGutierrezWind commented on Aug 1, 2026

    @RGutierrezWind

    I confirmed that OpenCode's TUI can run natively on Windows 11 ARM64 when OpenCode is compiled with a Bun build that includes Windows ARM64 bun:ffi/TinyCC support.

    Bun added this support in oven-sh/bun#33696. OpenCode currently pins Bun 1.3.14, which predates that change. This does not mean every version newer than 1.3.14 will work automatically; the OpenCode build must use a Bun version that contains that merged change.

    Tested environment:

    • Windows 11 ARM64
    • Bun 1.4.0-canary.1+df49a6e1c
    • OpenCode source commit 19231fce4b70aa5f7894a0a0eb20ff29bd417db5
    • OpenCode build version 1.18.10

    1. Download Bun Canary without replacing stable Bun

    $BunDir = "$HOME\Tools\bun-canary-arm64"
    $Archive = "$env:TEMP\bun-canary-arm64.zip"
    
    New-Item -ItemType Directory -Force $BunDir | Out-Null
    Invoke-WebRequest `
      "https://github.com/oven-sh/bun/releases/download/canary/bun-windows-aarch64.zip" `
      -OutFile $Archive
    Expand-Archive $Archive $BunDir -Force
    
    $Bun = (Get-ChildItem $BunDir -Recurse -Filter bun.exe |
      Select-Object -First 1).FullName
    
    & $Bun --revision
    

    2. Verify FFI before building OpenCode

    & $Bun -e @'
    import { dlopen, FFIType } from "bun:ffi";
    
    const lib = dlopen("kernel32.dll", {
      GetCurrentProcessId: {
        args: [],
        returns: FFIType.u32,
      },
    });
    
    console.log(`FFI_OK PID=${lib.symbols.GetCurrentProcessId()}`);
    lib.close();
    '@
    

    3. Clone and build OpenCode

    git clone --depth 1 --branch dev `
      https://github.com/anomalyco/opencode.git `
      opencode-arm64-canary
    
    Set-Location opencode-arm64-canary
    
    & $Bun install --ignore-scripts --linker hoisted
    
    $env:OPENCODE_VERSION = "1.18.10"
    $env:OPENCODE_CHANNEL = "latest"
    
    & $Bun run packages/opencode/script/build.ts `
      --single `
      --skip-install `
      --skip-embed-web-ui
    

    The executable is produced at:

    packages\opencode\dist\opencode-windows-arm64\bin\opencode.exe
    

    Validation performed

    • opencode.exe --version returned 1.18.10
    • The TUI completed bootstrap and remained running during a bounded startup check
    • Logs showed the Windows watcher and location services starting
    • No TinyCC is disabled, bun:ffi dlopen() is not available, or OpenTUI initialization errors were present

    This is still an experimental validation, not proof that the complete OpenCode test suite passes. The build skips dependency scripts and the embedded Web UI because tree-sitter-powershell attempted a local node-gyp build on the test machine, which lacked a Windows SDK. Full CI, native dependency, Web UI, plugin, and longer interactive-session testing are still needed.

    The durable path appears to be:

    1. Move OpenCode's build from Bun 1.3.14 to a Bun release containing Enable bun:ffi (TinyCC) on Windows ARM64 oven-sh/bun#33696.
    2. Run the complete OpenCode test/build matrix on Windows ARM64.
    3. Publish a newly verified official ARM64 artifact only after those tests pass.

    Bun 1.4.0-canary.1 proves the original TinyCC/FFI blocker is resolved, but readiness of the official OpenCode ARM64 release still depends on that integration and test coverage.

  13. neriousy commented on Oct 1, 2026

    @neriousy
    Member

    Bun 1.4.2 adds bun:ffi/TinyCC support for Windows ARM64, which the TUI needs. OpenCode has been built with Bun 1.4.2 since #47446, so the TUI starts natively on Windows ARM64 without a workaround. The same problem is tracked in #19130.

    Closing as completed. If the TUI still doesn't start on Windows ARM64 with the latest release, please open a new issue with your version and the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions