Windows: Installer should detect CPU capabilities and use baseline binary for CPUs without AVX2 #8756

Open
opened 2026-02-16 18:10:45 -05:00 by yindo · 3 comments
Owner

Originally created by @James1095 on GitHub (Feb 6, 2026).

Originally assigned to: @thdxr on GitHub.

Problem

OpenCode v1.1.53 hangs on startup on Windows with CPUs that lack AVX2 instructions (e.g., Intel Ivy Bridge, Sandy Bridge, early Haswell).

The opencode-windows-x64 binary requires AVX2, but the installer doesn't detect CPU capabilities. When run on a CPU without AVX2, the binary crashes with "Illegal instruction" before any output.

Environment

  • OpenCode version: 1.1.53
  • Platform: Windows 11 x64
  • CPU: Intel Xeon E3-1230 V2 (Ivy Bridge) - has AVX but not AVX2
  • Installation method: bun install -g opencode-ai

Steps to Reproduce

  1. On a Windows machine with a CPU lacking AVX2 (Ivy Bridge or older)
  2. Run bun install -g opencode-ai
  3. Run opencode
  4. Observe: hangs indefinitely, no output, no error message

Root Cause

The Bun shim at ~/.bun/bin/opencode resolves to opencode-windows-x64/bin/opencode.exe which is compiled with AVX2 instructions. The CPU throws "Illegal instruction" when executing AVX2 opcodes.

The baseline binary (opencode-windows-x64-baseline/bin/opencode.exe) works correctly:

# AVX2 binary - crashes
$ timeout 5 ~/.bun/install/global/node_modules/opencode-windows-x64/bin/opencode.exe --version
# Result: Illegal instruction (exit code 132)

# Baseline binary - works
$ timeout 5 ~/.bun/install/global/node_modules/opencode-windows-x64-baseline/bin/opencode.exe --version
1.1.53

Current Workaround

Manually replace the binary after each install/update:

Copy-Item "$env:USERPROFILE\.bun\install\global\node_modules\opencode-windows-x64-baseline\bin\opencode.exe" "$env:USERPROFILE\.bun\install\global\node_modules\opencode-windows-x64\bin\opencode.exe" -Force

Suggested Fix

The packages/opencode/bin/opencode launcher already supports OPENCODE_BIN_PATH environment variable, but Bun's shim bypasses this script entirely.

Options:

  1. Detect AVX2 at runtime in the launcher and fall back to baseline binary
  2. Use CPUID during postinstall to select the correct binary variant
  3. Document the workaround for users with older CPUs

Related

  • The baseline binary packages are already published (opencode-windows-x64-baseline, opencode-darwin-x64-baseline, etc.)
  • Similar issue may affect Linux/macOS users with older x64 CPUs
Originally created by @James1095 on GitHub (Feb 6, 2026). Originally assigned to: @thdxr on GitHub. ## Problem OpenCode v1.1.53 hangs on startup on Windows with CPUs that lack AVX2 instructions (e.g., Intel Ivy Bridge, Sandy Bridge, early Haswell). The `opencode-windows-x64` binary requires AVX2, but the installer doesn't detect CPU capabilities. When run on a CPU without AVX2, the binary crashes with "Illegal instruction" before any output. ## Environment - OpenCode version: 1.1.53 - Platform: Windows 11 x64 - CPU: Intel Xeon E3-1230 V2 (Ivy Bridge) - has AVX but **not AVX2** - Installation method: `bun install -g opencode-ai` ## Steps to Reproduce 1. On a Windows machine with a CPU lacking AVX2 (Ivy Bridge or older) 2. Run `bun install -g opencode-ai` 3. Run `opencode` 4. Observe: hangs indefinitely, no output, no error message ## Root Cause The Bun shim at `~/.bun/bin/opencode` resolves to `opencode-windows-x64/bin/opencode.exe` which is compiled with AVX2 instructions. The CPU throws "Illegal instruction" when executing AVX2 opcodes. The baseline binary (`opencode-windows-x64-baseline/bin/opencode.exe`) works correctly: ```bash # AVX2 binary - crashes $ timeout 5 ~/.bun/install/global/node_modules/opencode-windows-x64/bin/opencode.exe --version # Result: Illegal instruction (exit code 132) # Baseline binary - works $ timeout 5 ~/.bun/install/global/node_modules/opencode-windows-x64-baseline/bin/opencode.exe --version 1.1.53 ``` ## Current Workaround Manually replace the binary after each install/update: ```powershell Copy-Item "$env:USERPROFILE\.bun\install\global\node_modules\opencode-windows-x64-baseline\bin\opencode.exe" "$env:USERPROFILE\.bun\install\global\node_modules\opencode-windows-x64\bin\opencode.exe" -Force ``` ## Suggested Fix The `packages/opencode/bin/opencode` launcher already supports `OPENCODE_BIN_PATH` environment variable, but Bun's shim bypasses this script entirely. Options: 1. **Detect AVX2 at runtime** in the launcher and fall back to baseline binary 2. **Use CPUID during postinstall** to select the correct binary variant 3. **Document the workaround** for users with older CPUs ## Related - The baseline binary packages are already published (`opencode-windows-x64-baseline`, `opencode-darwin-x64-baseline`, etc.) - Similar issue may affect Linux/macOS users with older x64 CPUs
yindo added the windowsperf labels 2026-02-16 18:10:45 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 6, 2026):

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

  • #12512: SIGILL (Illegal Instruction) on Intel Xeon E3-1270 V2 (no AVX-512/AVX2 support) - Linux/AUR version with same root cause
  • #8744: [Bug] Windows binary selection picks AVX version on non-AVX CPUs - Previous Windows-specific report of the same binary selection issue
  • #8345: zsh: illegal hardware instruction opencode - macOS version with same CPU compatibility issue on Mac Pro (Late 2013)

These all report the same underlying problem of OpenCode binaries requiring AVX2 instructions on older CPUs (Ivy Bridge, Sandy Bridge, etc.) and crashing with illegal instruction errors.

Feel free to ignore if this addresses a different aspect of the issue.

@github-actions[bot] commented on GitHub (Feb 6, 2026): This issue might be a duplicate of existing issues. Please check: - #12512: SIGILL (Illegal Instruction) on Intel Xeon E3-1270 V2 (no AVX-512/AVX2 support) - Linux/AUR version with same root cause - #8744: [Bug] Windows binary selection picks AVX version on non-AVX CPUs - Previous Windows-specific report of the same binary selection issue - #8345: zsh: illegal hardware instruction opencode - macOS version with same CPU compatibility issue on Mac Pro (Late 2013) These all report the same underlying problem of OpenCode binaries requiring AVX2 instructions on older CPUs (Ivy Bridge, Sandy Bridge, etc.) and crashing with illegal instruction errors. Feel free to ignore if this addresses a different aspect of the issue.
Author
Owner

@BassemN commented on GitHub (Feb 8, 2026):

I am using Ubuntu 20.04.6 LTS. Opencode was running properly on version 1.1.51, but after upgrading to version 1.1.52 or 1.1.53, it no longer runs.

@BassemN commented on GitHub (Feb 8, 2026): I am using Ubuntu 20.04.6 LTS. Opencode was running properly on version 1.1.51, but after upgrading to version 1.1.52 or 1.1.53, it no longer runs.
Author
Owner

@pei55 commented on GitHub (Feb 9, 2026):

I am using Ubuntu 20.04.6 LTS. Opencode was running properly on version 1.1.51, but after upgrading to version 1.1.52 or 1.1.53, it no longer runs.

the same to you.

@pei55 commented on GitHub (Feb 9, 2026): # > I am using Ubuntu 20.04.6 LTS. Opencode was running properly on version 1.1.51, but after upgrading to version 1.1.52 or 1.1.53, it no longer runs. the same to you.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8756