opencode icon indicating copy to clipboard operation
opencode copied to clipboard

BunInstallFailedError for [email protected] - Dependency conflict with zod versions

Open ideas24h opened this issue 15 hours ago • 0 comments

Bug Report: BunInstallFailedError for [email protected]

Summary

OpenCode v1.1.25 fails to start with BunInstallFailedError for plugin [email protected] due to unresolvable dependency conflicts between the plugin's dependencies (zod@^3.24.0) and OpenCode's core dependencies ([email protected]).

Environment

  • OpenCode Version: 1.1.25
  • Operating System: macOS (Darwin 25.2.0) ARM64
  • Package Manager: Bun v1.3.5
  • Installation Method: Official install script (curl -fsSL https://opencode.ai/install | bash)
  • Plugin: [email protected]

Steps to Reproduce

  1. Install OpenCode using the official script:
    curl -fsSL https://opencode.ai/install | bash
    
  2. Run opencode from any directory
  3. Error occurs immediately on startup

Expected Behavior

OpenCode should start and run without errors, with the opencode-antigravity-auth plugin properly loaded.

Actual Behavior

OpenCode fails with the following error:

{
  "name": "BunInstallFailedError",
  "data": {
    "pkg": "opencode-antigravity-auth",
    "version": "1.2.8"
  }
}

Root Cause Analysis

The issue is caused by a dependency version conflict:

  1. OpenCode binary (v1.1.25) has [email protected] hardcoded internally
  2. Dependency Conflict:
  3. Automatic Installation: OpenCode binary automatically runs bun install on every startup, which creates bun.lock files that cause conflicts
  4. Version Incompatibility: The zod v3.x and v4.x are major version breaking changes and cannot be resolved simultaneously in the same dependency tree

Investigation Details

Attempted Solutions (all failed):

  1. ✅ Complete removal and reinstallation of OpenCode
  2. ✅ Manual installation of [email protected] in ~/.opencode/
  3. ✅ Installing both zod versions (3.24.0 and 4.1.8)
  4. ✅ Removing bun.lock files (temporarily fixes, but recreates on next run)
  5. ✅ Creating project-local .opencode directories with explicit version pinning

Verification:

# Plugin is available on npm
$ npm view opencode-antigravity-auth versions --json
# Shows: "1.2.8" is available

# Dependency conflict confirmed
$ cat ~/.opencode/node_modules/@opencode-ai/plugin/package.json | grep zod
"zod": "4.1.8"

$ cat ~/.opencode/node_modules/opencode-antigravity-auth/package.json | grep zod
"zod": "^3.24.0"

Workaround (Partial)

The only working solution is:

  1. Create .opencode directory in project folder with:
    {
      "dependencies": {
        "@opencode-ai/plugin": "1.1.25",
        "opencode-antigravity-auth": "1.2.8"
      }
    }
    
  2. Run bun install in .opencode directory
  3. Delete bun.lock (critical step)
  4. Only works when running opencode from that specific project directory

Limitation: Does not work from ~ or other directories, making OpenCode unusable globally.

Possible Solutions

Option 1: Update OpenCode Binary

Recompile OpenCode v1.1.25 with [email protected] (if compatible) or find a version that doesn't have zod conflicts.

Option 2: Update Plugin Dependencies

Request opencode-antigravity-auth maintainer to update to [email protected] to match OpenCode's requirements.

Option 3: Make Plugin Optional

Allow OpenCode to start even when plugin installation fails, with a warning instead of a hard error.

Option 4: Dependency Resolution

Improve OpenCode's dependency resolution to handle multiple major versions of zod (if possible with Bun's capabilities).

Additional Information

  • The hardcoded version 1.2.8 in the binary suggests this is a compiled-in dependency that cannot be easily changed by users
  • The plugin repository: https://github.com/NoeFabris/opencode-antigravity-auth
  • The plugin is essential for Google OAuth authentication (Gemini 3 Pro and Claude 4.5 access)

Impact

Severity: High - Makes OpenCode completely unusable for users who need Google authentication

Affected Users: Anyone using OpenCode v1.1.25 with the opencode-antigravity-auth plugin

Suggested Priority

This should be treated as a blocking issue since it prevents the application from starting at all.

ideas24h avatar Jan 17 '26 11:01 ideas24h