opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Crash when running opencode from ~/.config/opencode directory

Open cineraria01 opened this issue 4 days ago • 2 comments

Description

Running opencode from the ~/.config/opencode directory causes an immediate crash with cleanNode abort error.

Steps to Reproduce

  1. Navigate to the opencode config directory:
    cd ~/.config/opencode
    
  2. Run opencode:
    opencode
    

Expected Behavior

OpenCode should start normally regardless of the current working directory.

Actual Behavior

OpenCode crashes immediately with the following stack trace:

abort@[native code]
@/$bunfs/root/src/index.js:214603:19
cleanNode@/$bunfs/root/src/index.js:210165:24
cleanNode@/$bunfs/root/src/index.js:210160:16
cleanNode@/$bunfs/root/src/index.js:210160:16
... (repeated cleanNode calls)
updateComputation@/$bunfs/root/src/index.js:209843:12
runTop@/$bunfs/root/src/index.js:209968:24
runUserEffects@/$bunfs/root/src/index.js:210099:11
runUpdates@/$bunfs/root/src/index.js:209989:20
completeUpdates@/$bunfs/root/src/index.js:210049:15
runUpdates@/$bunfs/root/src/index.js:209990:20
setStore@/$bunfs/root/src/index.js:213539:10
processTicksAndRejections@

Root Cause Analysis

The ~/.config/opencode directory contains package.json and node_modules (created automatically for plugin management). When opencode detects these files in the current working directory, it appears to treat the config directory as a project, causing a recursive conflict.

Workaround: Run opencode from any other directory (e.g., cd ~ && opencode).

Environment

  • OpenCode version: 1.1.8
  • OS: Linux 5.15.0-134-generic (Ubuntu)
  • Runtime: Bun

Additional Context

  • Running from home directory (~) works fine
  • Running from any other project directory works fine
  • Only crashes when CWD is ~/.config/opencode

cineraria01 avatar Jan 09 '26 15:01 cineraria01