Skip to content

[Bug] OpenCode TUI freezes intermittently on WSL2 (input buffered), traced to Node.js v25.8 JIT generating SIGILL causing WSL kernel crashes #18132

@BHQM-123

Description

@BHQM-123

Description

OS: Windows 10 (build 19045.4412) with WSL2

WSL Distribution: Ubuntu 22.04 / 24.04 LTS (fresh install)

Hardware: MAXSUN B450M motherboard, AMD Ryzen 5 5500 CPU

Node.js: v25.8.0 (problematic) / v22.22.1 (fixed)

OpenCode Version: 1.2.27

Model Provider: China Unicom Yuanjing (GLM-5), API endpoint https://maas-api.ai-yuanjing.com/openapi/compatible-mode/v1/chat/completions

Problem Description
The OpenCode TUI version randomly freezes during normal use. The interface becomes completely unresponsive, but keyboard input is buffered—characters typed during the freeze appear all at once after recovery. Freezes last from seconds to minutes and occur unpredictably.

Key findings:

A friend with identical software configuration (same Node.js version, same API key) does not experience the issue.

OpenCode Web (opencode web) runs smoothly without freezes.

The problem persists even in a fresh Ubuntu 24.04 installation.

Tried Solutions (Ineffective)
1.Reinstalling WSL2 and Ubuntu (fresh 24.04 install)

  1. Changing terminals (Windows Terminal, VS Code terminal, native wsl)

  2. Disabling IPv6

  3. Increasing WSL2 memory limit (.wslconfig with 8GB)

  4. Clearing OpenCode cache (rm -rf ~/.cache/opencode)

  5. Testing with the same API key on a friend's machine (no issues there)

  6. Final Solution (Effective)

Downgrading to Node.js LTS (v22.22.1) completely resolved the issue:

bash
nvm install 22
nvm alias default 22
npm install -g opencode-ai
After this change, OpenCode runs smoothly without freezes, and no new crash dumps appear in wsl-crashes.

Root Cause Hypothesis
Node.js v25.8's JIT compiler, on certain CPUs (including AMD Ryzen 5 5500), generates illegal instructions (SIGILL).

OpenCode executing these instructions triggers a SIGILL from the Linux kernel.

The WSL2 kernel crashes, and the Windows WSL service automatically restarts the VM.

During the restart, the TUI freezes, but Windows terminal input buffering preserves typed characters.

After recovery, buffered input is "replayed," giving the illusion of input buffering.

The friend's CPU (likely newer or with a different instruction set) does not trigger this JIT bug

Recommendations
1.Document that WSL2 users should prefer Node.js LTS versions (v20/v22).

2.Consider a startup check to warn users if a non-LTS Node.js version is detected.

3.Improve error handling to gracefully recover from illegal instructions instead of crashing.

Plugins

not

OpenCode version

1.2.27

Steps to reproduce

1.Install Node.js v25.8.0 and OpenCode in WSL2.

2.Configure any model (e.g., China Unicom GLM-5).

3.Start a conversation and send several messages.

4.Wait for a random freeze (may occur after 2–3 messages or 10+).

Screenshot and/or share link

debug.txt

Operating System

Windows 10 (build 19045.4412) with WSL2

Terminal

Windows Terminal, VS Code terminal, native wsl

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions