opencode icon indicating copy to clipboard operation
opencode copied to clipboard

[Bug] Critical Crash on Linux (Ubuntu): 'jose' dependency corrupted with binary content in buffer_utils.js

Open asugan opened this issue 1 week ago • 0 comments

Description

Description When attempting to run opencode (e.g., opencode models or installing plugins) on a Linux/Ubuntu environment, the tool crashes immediately. The error points to a syntax error in the jose library, specifically in dist/browser/lib/buffer_utils.js.

Upon inspection, this JavaScript file contains binary/garbage characters instead of valid code, suggesting that the internal package manager/downloader (possibly Bun-based or custom fetcher) is not correctly downloading or extracting this specific dependency.

Error Log

Error: Unexpected error, check log file at ... 1 | G^۝><CCFkCQº2Ha*[8er ^ error: Unexpected at /home/USER/.cache/opencode/node_modules/jose/dist/browser/lib/buffer_utils.js:1:1

Root Cause Analysis I inspected the file located at ~/.cache/opencode/node_modules/jose/dist/browser/lib/buffer_utils.js. Instead of valid JavaScript, the file starts with binary characters (e.g., G^۝...), which looks like a GZIP artifact or a corrupted binary download that wasn't decoded properly.

Workaround / Fix I was able to resolve this by manually taking over the dependency installation using npm instead of the tool's internal mechanism.

Navigate to the cache directory: cd ~/.cache/opencode

Remove the corrupted modules and lock files: rm -rf node_modules bun.lock

Manually install dependencies using npm: npm install npm install [email protected] --save (forcing the correct version)

Running opencode models works perfectly after this manual fix.

Note on Persistence: If opencode triggers an internal update or plugin installation, it overwrites node_modules and re-introduces the corrupted binary file, requiring the workaround to be applied again.

System Info

OS: Linux (Ubuntu)

Node Version: Tested on v22.19.0 and v20.19.6 (Issue persists on both)

Opencode Version: Latest

Plugins

No response

OpenCode version

1.1.6

Steps to reproduce

  • Install opencode globally on Ubuntu (npm install -g opencode). -Run opencode models (or try to install a plugin). -The tool attempts to hydrate the cache/dependencies. -Crash occurs.

Screenshot and/or share link

No response

Operating System

Ubuntu 24.04.3 LTS

Terminal

Kitty Terminal

asugan avatar Jan 07 '26 19:01 asugan