Skip to content

Plugin loader incorrectly appends @latest to GitHub references #8763

Closed

Description

@frankekn

Description

When using a GitHub-hosted plugin like github:owner/repo, OpenCode appends @latest to form github:owner/repo@latest, which Bun cannot resolve.

Root Cause

In packages/opencode/src/plugin/index.ts:

const lastAtIndex = plugin.lastIndexOf("@")
const pkg = lastAtIndex > 0 ? plugin.substring(0, lastAtIndex) : plugin
const version = lastAtIndex > 0 ? plugin.substring(lastAtIndex + 1) : "latest"
plugin = await BunProc.install(pkg, version)  // becomes pkg + "@" + version

This creates github:owner/repo@latest which Bun fails to resolve with:

error: GET https://api.github.com/repos//latest/tarball/ - 404
error: github:owner/repo@latest failed to resolve

Bun's GitHub Dependency Format

According to Bun documentation, GitHub dependencies use # for version/tag specifiers, not @:

{
  "lodash": "git+ssh://github.com/lodash/lodash.git#4.17.21",
  "zod": "github:colinhacks/zod"
}

The @ syntax is only for npm registry packages.

Reproduction

bun add "github:lodash/lodash@latest"
# error: GET https://api.github.com/repos//latest/tarball/ - 404

bun add "github:lodash/lodash"
# Success - installs from default branch

bun add "github:lodash/lodash#main"
# Success - installs from main branch

Suggested Fix

Check if the plugin string starts with github: or git+ before appending version:

const isGitDependency = plugin.startsWith("github:") || plugin.startsWith("git+") || plugin.startsWith("git://")

if (isGitDependency) {
  // Don't append @latest for git dependencies
  // Or use # instead: pkg + "#" + version
  plugin = await BunProc.install(pkg, undefined)
} else {
  plugin = await BunProc.install(pkg, version)
}

Workaround

Publish the plugin to npm registry instead of using GitHub reference.

Activity

  1. github-actions commented on Jan 16, 2026

    @github-actions
    Contributor

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

    The #8264 feature request is asking for the ability to install plugins directly from GitHub (using the format github:owner/repo#version), which is closely related to the bug in this issue where OpenCode incorrectly appends @latest to GitHub references instead of using the proper #version syntax that Bun requires.

    Feel free to ignore if this doesn't address your specific case.

  2. github-actions commented on Mar 26, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

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