Skip to content

install crashes with ENOENT when ~/.config/opencode does not exist yet #93

Description

@Chebaleomkar

What's happening

On a machine where ~/.config/opencode doesn't exist yet, install crashes on its very first action with an unhandled ENOENT and a Node stack trace. Nothing gets set up: the plugin isn't registered, no commands are created, and the user never reaches the login step.

🧠 opencode-supermemory installer

Error: ENOENT: no such file or directory, open '/home/user/.config/opencode/supermemory.json'
    at writeFileSync (node:fs:2413:20)
    at writeInstallDefaults (.../dist/cli.js)
    at install (.../dist/cli.js)

Why it matters

install is the first command in the README and the entry point for every new user. The folder is missing whenever the plugin is installed before OpenCode has been run once, which is common:

  • new users who install OpenCode and the plugin in one go,
  • fresh CI runners, Docker images, dev containers, and headless servers,
  • anyone who wiped or relocated their OpenCode config.

For them the installer is unusable, and the stack trace gives no hint that creating the folder by hand is the workaround. The code has been there since #48 (May 2026), so every release since then is affected, including the current 2.0.15.

Reproduce

Sandboxed HOME, nothing real is touched. Reproduced with the published 2.0.15 on Linux (WSL2 Ubuntu 24.04) and Windows 11:

export HOME=$(mktemp -d)
bunx opencode-supermemory@latest install --no-tui
ls ~/.config/opencode

Actual: Error: ENOENT: no such file or directory, open '<HOME>/.config/opencode/supermemory.json', exit code 1, and ~/.config/opencode is never created.

Expected: the installer creates the folder and finishes (✓ Setup complete!), as it does when the folder already exists.

Cause

install() calls writeInstallDefaults() first (src/cli.ts:419), which does writeFileSync(~/.config/opencode/supermemory.json, …) (src/config.ts:231) without creating the directory. Every later install step already calls mkdirSync(OPENCODE_CONFIG_DIR, { recursive: true }) (src/cli.ts:309, :323, :347), but they never run because this first write throws.

Workaround

Run mkdir -p ~/.config/opencode before install.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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