GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Opencode race condition with installDependencies() · Issue #4137 · anomalyco/opencode

Opencode race condition with installDependencies() #4137

New issue
Copy link
New issue
Copy link
Closed
Closed
Opencode race condition with installDependencies()#4137
Copy link
Labels
bugSomething isn't workingopentuiThis relates to changes in v1.0, now that opencode uses opentui

Description

@wolfie82
wolfie82
opened on Nov 9, 2025
Issue body actions

Description

With recent versions of opencode >= 1.0.46, there appears to be a race condition when bun attempts to install packages from package.json in .opencode. We have some custom plugins that no longer function unless we manually do a npm install in the .opencode directory.

Issue:

18:52:01 +8ms - bun add fails (error code 1) - "An unknown error occurred (Unexpected)"
18:52:01 +417ms - bun add succeeds (code 0) - "@opencode-ai/[email protected] installed"
18:52:01 +4ms - Plugin loading starts (dynamic-context-loader.ts)
18:52:01 +11ms - ERROR: Cannot find module '@opencode-ai/plugin'

Timeline Analysis:

  1. First bun add attempt fails (exits immediately at +8ms)
  2. Second bun add attempt succeeds (takes 423ms, completes at +417ms)
  3. Plugin loading starts at +4ms (only 4ms after initial failure!)
  4. Import fails at +11ms (7ms later)

The Problem:

The successful bun add at +417ms is too late - plugin loading already started at +4ms.

  1. Concurrent execution - installDependencies() not awaited
  2. Plugin loader doesn't wait - Starts importing before dependencies installed
  3. Race condition - Even when install succeeds, timing is unpredictable

OpenCode version

1.0.46

Activity

  1. wolfie82
    added
    bugSomething isn't working
    on Nov 9, 2025
  2. github-actions commented on Nov 9, 2025

    @github-actions
    github-actionsBot
    on Nov 9, 2025 – with GitHub Actions
    Contributor
    More actions

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

    • BunInstallFailedError when upgrading opencode #4047: Both involve bun installation failures and plugin loading issues with similar error patterns
    • Cannot find module solid-plugin when building AUR package #4126: Same "Cannot find module" error when dependencies are missing during build/load process

    Feel free to ignore if none of these address your specific race condition case.

  3. github-actions
    added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Nov 9, 2025
  4. wolfie82 commented on Nov 9, 2025

    @wolfie82
    wolfie82
    on Nov 9, 2025
    ContributorAuthor
    More actions

    I didn't mention I was running on WSL, which is solved by using WSL 2.0

    oven-sh/bun#20724

  5. wolfie82
    closed this as completedon Nov 9, 2025
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

    bugSomething isn't workingopentuiThis relates to changes in v1.0, now that opencode uses opentui

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.