Repository navigation
Description
Summary
The Windows launcher script (bin/opencode) picks opencode-windows-x64 instead of opencode-windows-x64-baseline on CPUs without AVX support, causing immediate crash on startup.
Environment
- OS: Windows 11
- CPU: Intel/AMD without AVX (only SSE4.2)
- opencode-ai version: 1.1.19-1.1.22 (all affected)
- Node.js: v22.x
Error
Bun v1.3.6 (d530ed99) Windows x64 (baseline)
CPU: sse42
Features: ... no_avx2 no_avx ...
CPU lacks AVX support. Please consider upgrading to a newer CPU.
panic(main thread): Illegal instruction at address 0x7FF7132980FC
oh no: Bun has crashed.
Root Cause
The launcher script in bin/opencode uses:
const base = "opencode-" + platform + "-" + arch
// ...
for (const entry of entries) {
if (!entry.startsWith(base)) continue
// picks first match
}Both opencode-windows-x64 and opencode-windows-x64-baseline match the pattern opencode-windows-x64. The first match wins, which depends on filesystem ordering (directory enumeration order).
Suggested Fix
Option A: Check AVX support before selecting binary (preferred)
// Detect AVX support and prefer baseline when not available
const hasAvx = checkCpuFeature('avx');
const preferBaseline = !hasAvx;Option B: Prefer -baseline suffix when on Windows
// Sort entries to prefer baseline on Windows
entries.sort((a, b) => {
const aBaseline = a.includes('-baseline');
const bBaseline = b.includes('-baseline');
// Prefer baseline if no AVX detected
return preferBaseline ? (bBaseline - aBaseline) : (aBaseline - bBaseline);
});Option C: Document OPENCODE_BIN_PATH workaround prominently
Workaround
Users can set the OPENCODE_BIN_PATH environment variable to force the baseline binary:
[System.Environment]::SetEnvironmentVariable(
'OPENCODE_BIN_PATH',
'C:\Users\<USERNAME>\AppData\Roaming\npm\node_modules\opencode-ai\node_modules\opencode-windows-x64-baseline\bin\opencode.exe',
'User'
)Impact
This affects all Windows users with older CPUs that lack AVX support (pre-2011 Intel, pre-2012 AMD). The crash occurs immediately on startup before any meaningful error message can be displayed, making it difficult to diagnose.
References
- Related Bun issue: The crash is in Bun runtime, but the binary selection logic is in OpenCode
- Discovered via oh-my-opencode fork: https://github.com/sadnow/oh-my-opencode
Activity
github-actions commentedon Jan 15, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
shaunmorris commentedon Feb 5, 2026
This also affects linux users
github-actions commentedon Apr 7, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.