opencode icon indicating copy to clipboard operation
opencode copied to clipboard

opencode-copilot-auth error

Open Lain-droid opened this issue 4 months ago • 22 comments

INFO 2025-08-31T09:51:23 +323ms service=default version=0.5.29 args=[] opencode INFO 2025-08-31T09:51:23 +1ms service=app cwd=/root creating INFO 2025-08-31T09:51:23 +21ms service=app git INFO 2025-08-31T09:51:23 +40ms service=app name=plugin registering service INFO 2025-08-31T09:51:23 +2ms service=app name=config registering service INFO 2025-08-31T09:51:23 +20ms service=config path=/root/.config/opencode/config.json loading INFO 2025-08-31T09:51:23 +15ms service=config path=/root/.config/opencode/opencode.json loading INFO 2025-08-31T09:51:23 +1ms service=config path=/root/.config/opencode/opencode.jsonc loading INFO 2025-08-31T09:51:23 +49ms service=config agent={} mode={} command={} plugin=[] username=root loaded INFO 2025-08-31T09:51:23 +0ms service=plugin [email protected] loading plugin ERROR 2025-08-31T09:51:23 +41ms service=default name=ResolveMessage message=Cannot find module '/root/.cache/opencode/node_modules/opencode-copilot-auth' from '/$bunfs/root/opencode' code=ERR_MODULE_NOT_FOUND specifier=/root/.cache/opencode/node_modules/opencode-copilot-auth referrer=/$bunfs/root/opencode importKind=import-statement fatal

I tryed to install opencode-copilot-auth with bun but don't worked also I'm tryed reinstall several times it don't work too

Lain-droid avatar Aug 31 '25 11:08 Lain-droid

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

  • #2224: Support for airgapped installation - Similar plugin loading error in Docker environment
  • #735: MacOS 15.5 not running npm i - Same ERR_MODULE_NOT_FOUND pattern, resolved by running npm i in cache directory

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

github-actions[bot] avatar Aug 31 '25 11:08 github-actions[bot]

INFO 2025-08-31T11:30:58 +422ms service=default version=0.5.29 args=[] opencode INFO 2025-08-31T11:30:58 +2ms service=app cwd=/root creating INFO 2025-08-31T11:30:58 +13ms service=app git INFO 2025-08-31T11:30:58 +4ms service=app name=plugin registering service INFO 2025-08-31T11:30:58 +3ms service=app name=config registering service INFO 2025-08-31T11:30:58 +6ms service=config path=/root/.config/opencode/config.json loading INFO 2025-08-31T11:30:58 +2ms service=config path=/root/.config/opencode/opencode.json loading INFO 2025-08-31T11:30:58 +11ms service=config path=/root/.config/opencode/opencode.jsonc loading INFO 2025-08-31T11:30:58 +135ms service=config agent={} mode={} command={} plugin=[] username=root loaded INFO 2025-08-31T11:30:58 +0ms service=plugin [email protected] loading plugin INFO 2025-08-31T11:30:58 +1ms service=bun pkg=opencode-copilot-auth version=0.0.2 installing package using Bun's default registry resolution INFO 2025-08-31T11:30:58 +1ms service=bun cmd=["/root/.opencode/bin/opencode","add","--force","--exact","--cwd","/root/.cache/opencode","[email protected]"] cwd=/root/.cache/opencode running INFO 2025-08-31T11:30:59 +580ms service=bun code=0 stdout=bun add v1.2.19 (aad3abea)

installed [email protected]

14 packages installed [465.00ms] stderr=Saved lockfile done ERROR 2025-08-31T11:30:59 +20ms service=default name=ResolveMessage message=Cannot find module '/root/.cache/opencode/node_modules/opencode-copilot-auth' from '/$bunfs/root/opencode' code=ERR_MODULE_NOT_FOUND specifier=/root/.cache/opencode/node_modules/opencode-copilot-auth referrer=/$bunfs/root/opencode importKind=import-statement fatal root@localhost:~#

Lain-droid avatar Aug 31 '25 11:08 Lain-droid

what happens if you do:

rm -rf ~/.cache/opencode

and then try again

rekram1-node avatar Aug 31 '25 13:08 rekram1-node

@Lain-droid same issue here, in a proot environment under termux...

pulpo avatar Aug 31 '25 15:08 pulpo

Yeah its proot too

Lain-droid avatar Sep 01 '25 08:09 Lain-droid

I tried with the latest version (0.6.0), also deleting the .cache/opencode, an the problem is still present.

pulpo avatar Sep 01 '25 22:09 pulpo

I mentioned this to Dax yesterday so I think he is looking into it

rekram1-node avatar Sep 01 '25 22:09 rekram1-node

Im also encountering this issue, on version 0.6.4

HavardPede avatar Sep 04 '25 20:09 HavardPede

Does this mean you cannot authenticate with GitHub at the moment? Can you confirm? I'm scared to update opencode since I use it with GitHub

fkukuck avatar Sep 08 '25 11:09 fkukuck

no it doesnt mean you can’t authenticate it just means occasionally an error will happen and you may have to send a message twice until Dax fixes it, when I say twice I dont mean literally type it out twice itd be more like:

  • send message
  • api error
  • send “.” works

rekram1-node avatar Sep 08 '25 13:09 rekram1-node

INFO 2025-09-13T19:26:28 +907ms service=default version=0.7.9 args=["auth","login"] opencode INFO 2025-09-13T19:26:28 +1ms service=project directory=/home/supastishn fromDirectory INFO 2025-09-13T19:26:28 +168ms service=models.dev file={} refreshing INFO 2025-09-13T19:26:28 +520ms service=models.dev file ={} refreshing INFO 2025-09-13T19:26:46 +17593ms service=config path=/home/supastishn/.config/opencode/config.json loading INFO 2025-09-13T19:26:46 +2ms service=config path=/home/supastishn/.config/opencode/opencode.json loading INFO 2025-09-13T19:26:46 +2ms service=config path=/home/supastishn/.config/opencode/opencode.jsonc loading INFO 2025-09-13T19:26:46 +123ms service=plugin [email protected] loading plugin INFO 2025-09-13T19:26:46 +22ms service=bun pkg=opencode-copilot-auth version=0.0.2 installing package using Bun's default registry resolution INFO 2025-09-13T19:26:46 +5ms service=bun cmd=["/home/supastishn/node_modules/opencode-linux-arm64/bin/opencode","add","--force","--exact","--cwd","/home/supastishn/.cache/opencode","[email protected]"] cwd=/home/supastishn/.cache/opencode running INFO 2025-09-13T19:26:46 +131ms service=bun code=0 stdout=bun add v1.2.21 (7c45ed97) installed [email protected]

1 package installed [51.00ms] stderr=Saved lockfile done ERROR 2025-09-13T19:26:46 +8ms service=default name=Reso lveMessage message=Cannot find module '/home/supastishn/ .cache/opencode/node_modules/opencode-copilot-auth' from '/$bunfs/root/index.js' code=ERR_MODULE_NOT_FOUND speci fier=/home/supastishn/.cache/opencode/node_modules/openc ode-copilot-auth referrer=/$bunfs/root/index.js importKi nd=import-statement fatal

im getting the error when i run opencode auth login, even without using github copilot provider. tried deleting cache to no svsil

supastishn avatar Sep 13 '25 19:09 supastishn

@supastishn what do u see if you run:

(cd ~/.cache/opencode && BUN_BE_BUN=1 opencode pm ls)

rekram1-node avatar Sep 13 '25 20:09 rekram1-node

I just resolved a similar module-not-found error by deleting everything and reinstall using npm. Reinstall using bun from scratch does not resolve the error. I suspect it this might have to do with mixup of npm and bun - but i am not familiar with both so this is a pure speculation. I am behind a coporate proxy and bun's support of proxy does not seem to work consistently (It hangs installing missing modules reported by opencode). I suspect that might be the culprit (https://github.com/oven-sh/bun/issues/1440).

yungchinghsiao avatar Oct 18 '25 03:10 yungchinghsiao

im having a similar error here in my 15.5 macos

~/.cache/opencode > npm i @ai-sdk/anthropic@beta                                                                                                                                                                                                                        took 5s at 11:41:07
⠙(node:68885) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use `node --trace-warnings ...` to show where the warning was created)

added 7 packages in 17s

1 package is looking for funding
  run `npm fund` for details
~/.cache/opencode > (cd ~/.cache/opencode && BUN_BE_BUN=1 opencode pm ls)                                                                                                                                                                                              took 18s at 11:41:30
[3.92ms] migrated lockfile from package-lock.json
/Users/gabriel.bem/.cache/opencode node_modules (7)
└── @ai-sdk/[email protected]
~/.cache/opencode > opencode auth login                                                                                                                                                                                                                                         at 11:41:37

┌  Add credential
│
◇  Select provider
│  GitHub Copilot
Error: Unexpected error, check log file at /Users/gabriel.bem/.local/share/opencode/log/2025-10-20T144142.log for more details
~/.cache/opencode > cat /Users/gabriel.bem/.local/share/opencode/log/2025-10-20T144142.log                                                                                                                                                                              took 3s at 11:41:45
INFO  2025-10-20T14:41:42 +70ms service=default version=0.15.8 args=["auth","login"] opencode
INFO  2025-10-20T14:41:42 +0ms service=project directory=/Users/gabriel.bem/.cache/opencode fromDirectory
INFO  2025-10-20T14:41:42 +5ms service=models.dev file={} refreshing
INFO  2025-10-20T14:41:42 +308ms service=models.dev file={} refreshing
INFO  2025-10-20T14:41:43 +1141ms service=config path=/Users/gabriel.bem/.config/opencode/config.json loading
INFO  2025-10-20T14:41:43 +0ms service=config path=/Users/gabriel.bem/.config/opencode/opencode.json loading
INFO  2025-10-20T14:41:43 +1ms service=config path=/Users/gabriel.bem/.config/opencode/opencode.jsonc loading
INFO  2025-10-20T14:41:43 +4ms service=bun cmd=["/opt/homebrew/Cellar/opencode/0.15.8/libexec/lib/node_modules/opencode-ai/node_modules/opencode-darwin-arm64/bin/opencode","add","@opencode-ai/[email protected]","--exact"] cwd=/Users/gabriel.bem/.config/opencode running
INFO  2025-10-20T14:41:43 +4ms service=bun cmd=["/opt/homebrew/Cellar/opencode/0.15.8/libexec/lib/node_modules/opencode-ai/node_modules/opencode-darwin-arm64/bin/opencode","add","@opencode-ai/[email protected]","--exact"] cwd=/Users/gabriel.bem/.opencode running
INFO  2025-10-20T14:41:43 +2ms service=plugin [email protected] loading plugin
INFO  2025-10-20T14:41:43 +0ms service=bun pkg=opencode-copilot-auth version=0.0.3 installing package using Bun's default registry resolution
INFO  2025-10-20T14:41:43 +0ms service=bun cmd=["/opt/homebrew/Cellar/opencode/0.15.8/libexec/lib/node_modules/opencode-ai/node_modules/opencode-darwin-arm64/bin/opencode","add","--force","--exact","--cwd","/Users/gabriel.bem/.cache/opencode","[email protected]"] cwd=/Users/gabriel.bem/.cache/opencode running
INFO  2025-10-20T14:41:44 +902ms service=bun code=1 stdout=bun add v1.3.0 (b0a6feca)
 stderr=Resolving dependencies
Resolved, downloaded and extracted [1]
error: GET https://npm.pkg.github.com/@opencode-ai%2fplugin - 404
 done
ERROR 2025-10-20T14:41:44 +0ms service=default e=Command failed with exit code 1 rejection
INFO  2025-10-20T14:41:44 +16ms service=bun code=1 stdout=bun add v1.3.0 (b0a6feca)
 stderr=[0.16ms] migrated lockfile from package-lock.json
Resolving dependencies
Resolved, downloaded and extracted [1]
error: GET https://npm.pkg.github.com/opencode-copilot-auth - 404
 done
ERROR 2025-10-20T14:41:44 +15ms service=default pkg=opencode-copilot-auth version=0.0.3 name=BunInstallFailedError message=BunInstallFailedError cause=Error: Command failed with exit code 1 stack=BunInstallFailedError: BunInstallFailedError
    at <anonymous> (/$bunfs/root/index.js:68596:43)
    at processTicksAndRejections (native:7:39) fatal
INFO  2025-10-20T14:41:45 +780ms service=bun code=1 stdout=bun add v1.3.0 (b0a6feca)
 stderr=Resolving dependencies
Resolved, downloaded and extracted [1]
error: GET https://npm.pkg.github.com/@opencode-ai%2fplugin - 404
 done
ERROR 2025-10-20T14:41:45 +0ms service=default e=Command failed with exit code 1 rejection

I’m getting a similar error on macOS 15.5 — looks like GET https://npm.pkg.github.com/opencode-copilot-auth doesn’t exist (404).

gabrieldebem avatar Oct 20 '25 14:10 gabrieldebem

@gabrieldebem can you do:

rm -rf ~/.cache/opencode

then run:

opencode run hello --print-logs

rekram1-node avatar Oct 20 '25 15:10 rekram1-node

@gabrieldebem can you do:

rm -rf ~/.cache/opencode

then run:

opencode run hello --print-logs

Hi rekram1-node,

Hope you are well.

Same issue. Your input gives:

[root@localhost ~]# rm -rf ~/.cache/opencode [root@localhost ~]# opencode run hello --print-logs INFO 2025-10-22T08:30:00 +23481ms service=default version=0.1 5.13 args=["run","hello","--print-logs"] opencode INFO 2025-10-22T08:30:00 +5ms service=project directory=/root fromDirectory INFO 2025-10-22T08:30:00 +159ms service=config path=/root/.config/opencode/config.json loading INFO 2025-10-22T08:30:00 +11ms service=config path=/root/.config/opencode/opencode.json loading INFO 2025-10-22T08:30:00 +1ms service=config path=/root/.config/opencode/opencode.jsonc loading INFO 2025-10-22T08:30:00 +23ms service=bun cmd=["/root/.openc ode/bin/opencode","add","@opencode-ai/[email protected]","--exact "] cwd=/root/.config/opencode running INFO 2025-10-22T08:30:00 +43ms service=bun cmd=["/root/.openc ode/bin/opencode","add","@opencode-ai/[email protected]","--exact "] cwd=/root/.opencode running INFO 2025-10-22T08:30:00 +58ms service=bun code=1 stdout=bun add v1.3.0 (b0a6feca) installed @opencode-ai/[email protected] Failed to install 1 package [65.00ms] done stderr=FileNotFound: failed copying files from cache to desti nation for package @opencode-ai/sdk Saved lockfile done ERROR 2025-10-22T08:30:00 +0ms service=default e=Command faile d with exit code 1 rejection INFO 2025-10-22T08:30:01 +275ms service=plugin path=opencode- [email protected] loading plugin INFO 2025-10-22T08:30:01 +11ms service=bun pkg=opencode-copil ot-auth version=0.0.3 installing package using Bun's default r egistry resolution INFO 2025-10-22T08:30:01 +1ms service=bun cmd=["/root/.openc

ode/bin/opencode","add","@opencode-ai/[email protected]","--exact"] cwd=/root/.opencode running INFO 2025-10-22T08:30:00 +58ms service=bun code=1 stdout=bun add v1.3.0 (b0a6feca) installed @opencode-ai/[email protected]

Failed to install 1 package [65.00ms] done stderr=FileNotFound: failed copying files from cache to desti nation for package @opencode-ai/sdk Saved lockfile done ERROR 2025-10-22T08:30:00 +0ms service=default e=Command failed with exit code 1 rejection INFO 2025-10-22T08:30:01 +275ms service=plugin [email protected] loading plugin INFO 2025-10-22T08:30:01 +11ms service=bun pkg=opencode-copil ot-auth version=0.0.3 installing package using Bun's default r egistry resolution INFO 2025-10-22T08:30:01 +1ms service=bun cmd=["/root/.openc$de/bin/opencode","add","--force","--exact","--cwd","/root/.cac he/opencode","[email protected]"] cwd=/root/.cache/o pencode running INFO 2025-10-22T08:30:01 +211ms service=bun code=0 stdout=bun add v1.3.0 (b0a6feca) installed [email protected]

1 package installed [82.00ms] stderr=Saved lockfile done ERROR 2025-10-22T08:30:01 +45ms service=default name=ResolveMe ssage message=Cannot find module '/root/.cache/opencode/node_m odules/opencode-copilot-auth' from '/$bunfs/root/index.js' cod e=ERR_MODULE_NOT_FOUND specifier=/root/.cache/opencode/node_mo dules/opencode-copilot-auth referrer=/$bunfs/root/index.js imp ortKind=import-statement fatal Error: Unexpected error, check log file at for more details

error: Cannot find module '/root/.cache/opencode/node_modules/ opencode-copilot-auth' from '/$bunfs/root/index.js' INFO 2025-10-22T08:30:01 +587ms service=bun code=0 stdout=bun add v1.3.0 (b0a6feca)

installed @opencode-ai/[email protected]

3 packages installed [1154.00ms] stderr=Saved lockfile done [root@localhost ~]#

621625 avatar Oct 22 '25 08:10 621625

I just resolved a similar module-not-found error by deleting everything and reinstall using npm. Reinstall using bun from scratch does not resolve the error. I suspect it this might have to do with mixup of npm and bun - but i am not familiar with both so this is a pure speculation. I am behind a coporate proxy and bun's support of proxy does not seem to work consistently (It hangs installing missing modules reported by opencode). I suspect that might be the culprit (oven-sh/bun#1440).

Hello,

Hope you are well.

What is the process to delete everything? I also kind of which there were an uninstall flag or something that uninstalls and purges everything.

621625 avatar Oct 22 '25 08:10 621625

I just resolved a similar module-not-found error by deleting everything and reinstall using npm. Reinstall using bun from scratch does not resolve the error. I suspect it this might have to do with mixup of npm and bun - but i am not familiar with both so this is a pure speculation. I am behind a coporate proxy and bun's support of proxy does not seem to work consistently (It hangs installing missing modules reported by opencode). I suspect that might be the culprit (oven-sh/bun#1440).

I can confirm this did the trick for me as well.

cd ~/.cache/opencode
rm -rf ./node_modules
npm install
opencode auth login

honzakostejn avatar Nov 07 '25 14:11 honzakostejn

This did't worked for me. getting same error. On version [v1.0.143]

I just resolved a similar module-not-found error by deleting everything and reinstall using npm. Reinstall using bun from scratch does not resolve the error. I suspect it this might have to do with mixup of npm and bun - but i am not familiar with both so this is a pure speculation. I am behind a coporate proxy and bun's support of proxy does not seem to work consistently (It hangs installing missing modules reported by opencode). I suspect that might be the culprit (oven-sh/bun#1440).

I can confirm this did the trick for me as well.

cd ~/.cache/opencode rm -rf ./node_modules npm install opencode auth login

ajinkyaT avatar Dec 11 '25 03:12 ajinkyaT

@ajinkyaT do you need copilot auth? If not set this env var: OPENCODE_DISABLE_DEFAULT_PLUGINS=1

rekram1-node avatar Dec 11 '25 03:12 rekram1-node

I had a similar issue, I wanted to use the new GHE support, but I didn't get to the prompt to input the .ghe.com domain, it would just hang on the bun command as it printed int the logs. I found this in another GH issues and that worked for me:

rm ~/.bun/install/cache -rf 

codemuse avatar Dec 11 '25 13:12 codemuse