You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unhelpful 'An unknown git error occurred' when github: plugin source is 404 #54483
Adding a github: plugin source that 404s fails with an unhelpful An unknown git error occurred instead of surfacing the real git/GitHub error (repository not found). plugin list then shows the entry with ID - / VERSION - and no hint at the cause.
Repro
Add to global config plugins array (~/.config/opencode/opencode.jsonc): "github:anomalyco/opencode-ios#main::path:packages/notify-plugin"
Server attempts plugin reconciliation on config reload (no restart).
opencode plugin list shows:
ID VERSION SOURCE
- - github:anomalyco/opencode-ios#main::path:packages/notify-plugin
Expected
Error should surface the underlying cause, e.g. repository 'https://github.com/anomalyco/opencode-ios.git/' not found (404), including the repo URL, so users can distinguish typo/private-repo/no-access from a transient git failure.
Actual
Server log only reports:
message="failed to load plugin" target=github:anomalyco/opencode-ios#main::path:packages/notify-plugin cause="Cause([Fail(NpmInstallFailedError (cause: Error: An unknown git error occurred))])"
plus failed to check plugin update ... Package is not installed.
Diagnostics
opencode v2.0.26, Darwin arm64 (Darwin Kernel 27.0.0, RELEASE_ARM64_T8132)
Manual check confirms the underlying error:
$ git ls-remote https://github.com/anomalyco/opencode-ios.git HEAD
remote: Repository not found.
fatal: repository 'https://github.com/anomalyco/opencode-ios.git/' not found
(GitHub web also returns 404 for the repo; SSH has no key on this machine: Permission denied (publickey), so private-repo access can't be ruled out — but either way the real error is swallowed.)
Plugin cache dir created but empty: ~/.cache/opencode/npm/git-opencode-ios-073cbcdfe887/ (0 files), so install clearly fetched nothing.
Other local plugins (agi-memory, clean-view, ponytail, postman, rtk) load fine — isolated to the github: source.
Raw GET /api/plugin on the background service returns 401 Authentication required; opencode plugin list (authenticated CLI path) was used instead.
Thanks for the detailed report! I could reproduce this on 2.0.26, and it still happens on the latest dev (e31136b).
With a clean config, running opencode plugin add "github:anomalyco/opencode-ios#main::path:packages/notify-plugin" exits with only:
NpmInstallFailedError:
[cause]: Error: An unknown git error occurred
Running git ls-remote against the same URL gives a real git error, but OpenCode doesn't show it. It looks like the git library OpenCode uses (npm's @npmcli/git) gives every failure it doesn't recognize this generic message. Git's actual output is only stored on the error object, and OpenCode's install error never prints it. The script below reproduces it.
Related: #50080 and PR #50252 (adding the cause to NpmInstallFailedError). For git failures that would still only show the generic message, so git's own output needs to be shown as well.
Reproduction script (repro.sh)
#!/usr/bin/env bash# Reproduces #54483: installing a github: plugin whose repo does not exist# fails with "An unknown git error occurred" and hides git's real error.# Usage: ./repro.sh (uses `opencode` from PATH)# OC_DEV=/path/to/checkout ./repro.sh (runs from source)set -u
WORK=$(mktemp -d)export HOME=$WORK XDG_CONFIG_HOME=$WORK/.config XDG_CACHE_HOME=$WORK/.cache \
XDG_DATA_HOME=$WORK/.local/share XDG_STATE_HOME=$WORK/.local/state
cd"$WORK"
SPEC="github:anomalyco/opencode-ios#main::path:packages/notify-plugin"if [ -n"${OC_DEV:-}" ];then
OC=(bun --conditions=browser --preload="$OC_DEV/packages/tui/node_modules/@opentui/solid/scripts/preload.js""$OC_DEV/packages/cli/src/index.ts")
else
OC=(opencode)
fiecho"== opencode version: $("${OC[@]}" --version)"echo"== what git itself says:"
GIT_TERMINAL_PROMPT=0 git ls-remote https://github.com/anomalyco/opencode-ios.git HEAD 2>&1echo"== opencode plugin add $SPEC""${OC[@]}" plugin add "$SPEC"2>&1echo"== exit code: $?"
I'd like to take this. Traced the swallow to packages/util/src/npm.ts: reify() wraps every arborist.reify failure into NpmInstallFailedError with the raw npm error as cause, and for git specs @npmcli/git reduces anything it doesn't recognize to "An unknown git error occurred" while keeping git's real stderr on the error object — which we never print. Plan: unwrap that stored output when constructing the error in reify (and check) so the surfaced message shows the actual cause, e.g. repository 'https://github.com/anomalyco/opencode-ios.git/' not found. This picks up where #50252 left the git-failure case.
Activity
opencode-agent commentedon Oct 11, 2026
Thanks for the detailed report! I could reproduce this on 2.0.26, and it still happens on the latest
dev(e31136b).With a clean config, running
opencode plugin add "github:anomalyco/opencode-ios#main::path:packages/notify-plugin"exits with only:Running
git ls-remoteagainst the same URL gives a real git error, but OpenCode doesn't show it. It looks like the git library OpenCode uses (npm's@npmcli/git) gives every failure it doesn't recognize this generic message. Git's actual output is only stored on the error object, and OpenCode's install error never prints it. The script below reproduces it.Related: #50080 and PR #50252 (adding the cause to
NpmInstallFailedError). For git failures that would still only show the generic message, so git's own output needs to be shown as well.Reproduction script (repro.sh)
Run it:
bash repro.shliudongyan13701205717-source commentedon Oct 11, 2026
I'd like to take this. Traced the swallow to
packages/util/src/npm.ts:reify()wraps everyarborist.reifyfailure intoNpmInstallFailedErrorwith the raw npm error ascause, and for git specs@npmcli/gitreduces anything it doesn't recognize to "An unknown git error occurred" while keeping git's real stderr on the error object — which we never print. Plan: unwrap that stored output when constructing the error inreify(andcheck) so the surfaced message shows the actual cause, e.g.repository 'https://github.com/anomalyco/opencode-ios.git/' not found. This picks up where #50252 left the git-failure case.