Skip to content

[linux] opencode silently exits (code 0) on x86_64 CPUs without AVX2 support when installed via npm #20116

Closed as not planned

Description

@PabloVitasso

Description

Running opencode after npm install -g opencode-ai produces no output and exits silently with code 0 on x86_64 Linux systems that do not support AVX2 instructions.

Environment

  • OS: Linux (Debian-based, glibc)
  • Arch: x86_64 (no AVX2)
  • Node: v24.13.1
  • Package: opencode-ai (npm global install)
  • opencode version: latest (0.0.55 at time of writing)

Steps to reproduce

  1. On an x86_64 machine without AVX2: cat /proc/cpuinfo | grep avx2 returns nothing
  2. npm install -g opencode-ai
  3. Run opencode — no output, exits with code 0

Root cause

Two bugs compound to cause this:

  1. Wrong binary selected during postinstall: postinstall.mjs resolves opencode-linux-x64 (no -baseline suffix) even on CPUs without AVX2. The correct package for non-AVX2 CPUs is
    opencode-linux-x64-baseline. The AVX2 check logic exists in the wrapper script bin/opencode but not in postinstall.mjs, so the wrong binary gets hard-linked to bin/.opencode.
  2. Silent failure in wrapper: When the binary is killed by SIGBUS (due to an illegal instruction), spawnSync returns result.status = null. The wrapper then does:
    const code = typeof result.status === "number" ? result.status : 0
    process.exit(code)
  3. null is not a number, so it exits with code 0 — no error, no output.

Workaround

Install using the official shell installer instead of npm:

curl -fsSL https://github.com/opencode-ai/opencode/releases/latest/download/opencode-linux-x86_64.tar.gz | tar xz -C ~/.local/bin

Or manually after npm install:

Download the correct baseline binary

curl -fsSL https://github.com/opencode-ai/opencode/releases/latest/download/opencode-linux-x86_64.tar.gz
| tar xz -C ~/.opencode/bin
export PATH="$HOME/.opencode/bin:$PATH"

Suggested fixes

  1. In postinstall.mjs: mirror the AVX2 detection logic from bin/opencode to select the correct -baseline package on non-AVX2 x86_64 CPUs.
  2. In bin/opencode: when result.signal is set (e.g. SIGBUS, SIGILL), print a diagnostic error and exit non-zero instead of silently exiting 0:
    if (result.signal) {
    console.error(opencode binary crashed with signal ${result.signal}. Your CPU may not support the required instructions.)
    process.exit(1)
    }

Plugins

No response

OpenCode version

No response

Steps to reproduce

  1. On x86_64 machine without AVX2: confirm with grep avx2 /proc/cpuinfo (no output)
  2. Install Node.js (e.g. via nvm): nvm install 24
  3. npm install -g opencode-ai
  4. Run opencode — no output, exits silently with code 0

To confirm the crash: strace -e trace=signal opencode 2>&1 | grep -E "SIGBUS|SIGILL" shows SIGBUS.

Screenshot and/or share link

No response

Operating System

Debian GNU/Linux 12 (Bookworm)

Terminal

tmux (screen-256color)

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 30, 2026
  2. github-actions commented on Mar 30, 2026

    @github-actions
    Contributor

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

    If your issue adds new information (particularly the silent exit code 0 via result.signal handling), please link to those issues so maintainers can track the full picture.

  3. removed
    bugSomething isn't working
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  4. github-actions commented on Jul 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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