Skip to content

Unable to login with zen provider. #3335

Closed

Description

@Simpaqt

Description

Whenever i try to login with opencode zen (recommended) it freezes entirely.

if i run

opencode auth login zen

This is my result:

┌  Add credential
Error: Unexpected error, check log file at /home/simpa/.local/share/opencode/log/2025-10-21T180236.log for more details

113003 |       directory: process.cwd(),
113004 |       async fn() {
113005 |         UI2.empty();
113006 |         Ge("Add credential");
113007 |         if (args2.url) {
113008 |           const wellknown = await fetch(`${args2.url}/.well-known/opencode`).then((x3) => x3.json());
         ^
TypeError: fetch() URL is invalid
 code: "ERR_INVALID_URL"

      at fetch (unknown:1:1)
      at fn (/$bunfs/root/index.js:113008:40)
      at fn (/$bunfs/root/index.js:113004:22)
      at processTicksAndRejections (native:7:39)

Logfile:

INFO  2025-10-21T18:02:36 +120ms service=default version=0.15.12 args=["auth","login","zen"] opencode
INFO  2025-10-21T18:02:36 +0ms service=project directory=/home/simpa fromDirectory
ERROR 2025-10-21T18:02:36 +15ms service=default name=TypeError message=fetch() URL is invalid stack=TypeError: fetch() URL is invalid
    at fetch (unknown)
    at fn (/$bunfs/root/index.js:113008:40)
    at fn (/$bunfs/root/index.js:113004:22)
    at processTicksAndRejections (native:7:39) fatal

Seems to be an invalid URL or I am an idiot unable to get it working. :D

Some guidance would be nice

OpenCode version

0.15.12

Steps to reproduce

  • opencode auth login zen

Screenshot and/or share link

No response

Operating System

Arch Linux 6.17.2-zen1-1-zen

Terminal

Ghostty

Activity

  1. github-actions commented on Oct 21, 2025

    @github-actions
    Contributor

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

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

  2. rekram1-node commented on Oct 21, 2025

    @rekram1-node
    Contributor

    @Simpaqt it is interactive so you need to do this (im using bun x opencode-ai@latest for you that's just opencode:

    Image Image

    Then enter your key and hit submit

  3. self-assigned this
    on Oct 21, 2025
  4. Simpaqt commented on Oct 21, 2025

    @Simpaqt
    Author

    @Simpaqt it is interactive so you need to do this (im using bun x opencode-ai@latest for you that's just opencode:

    Image Image
    Then enter your key and hit submit

    I see, well bun doesnt work for me. Not sure what the issue is with it but its stuck on resolve and never moves.

    As for opencode auth login. It doesnt move past this point.

    Image
  5. Simpaqt commented on Oct 21, 2025

    @Simpaqt
    Author

    Here are the --print-logs version

    ~ took 1m58s
    ❯ opencode auth login --print-logs
    INFO  2025-10-21T19:35:02 +118ms service=default version=0.15.12 args=["auth","login","--print-logs"] opencode
    INFO  2025-10-21T19:35:02 +0ms service=project directory=/home/simpa fromDirectory
    
    ┌  Add credential
    INFO  2025-10-21T19:35:02 +4ms service=models.dev file={} refreshing
    INFO  2025-10-21T19:35:03 +1119ms service=models.dev file={} refreshing
    │
    ◇  Select provider
    │  OpenCode Zen
    INFO  2025-10-21T19:35:05 +1444ms service=config path=/home/simpa/.config/opencode/config.json loading
    INFO  2025-10-21T19:35:05 +1ms service=config path=/home/simpa/.config/opencode/opencode.json loading
    INFO  2025-10-21T19:35:05 +0ms service=config path=/home/simpa/.config/opencode/opencode.jsonc loading
    INFO  2025-10-21T19:35:05 +4ms service=bun cmd=["/home/simpa/.npm-global/lib/node_modules/opencode-ai/node_modules/opencode-linux-x64/bin/opencode","add","@opencode-ai/plugin@0.15.12","--exact"] cwd=/home/simpa/.config/opencode running
    INFO  2025-10-21T19:35:05 +2ms service=plugin path=opencode-copilot-auth@0.0.3 loading plugin
    INFO  2025-10-21T19:35:05 +1ms service=bun pkg=opencode-copilot-auth version=0.0.3 installing package using Bun's default registry resolution
    INFO  2025-10-21T19:35:05 +0ms service=bun cmd=["/home/simpa/.npm-global/lib/node_modules/opencode-ai/node_modules/opencode-linux-x64/bin/opencode","add","--force","--exact","--cwd","/home/simpa/.cache/opencode","opencode-copilot-auth@0.0.3"] cwd=/home/simpa/.cache/opencode running
    
  6. rekram1-node commented on Oct 21, 2025

    @rekram1-node
    Contributor

    @Simpaqt what kind of network speed do you have this could be issue with installing the necessary provider packages.

    It looks like it is downloading from npm but it is stuck on that download.

    If you let it run it should resolve, for me it takes less than a second but depending on ur network it could take longer

  7. Simpaqt commented on Oct 21, 2025

    @Simpaqt
    Author

    I would say i have a decent enough connection..

    Image
  8. rekram1-node commented on Oct 21, 2025

    @rekram1-node
    Contributor

    i guess what happens if you just let it play out?

  9. Simpaqt commented on Oct 21, 2025

    @Simpaqt
    Author

    @rekram1-node well it moved a bit.

    this is what is showing currently

    ~ took 1m58s
    ❯ opencode auth login --print-logs
    INFO  2025-10-21T19:35:02 +118ms service=default version=0.15.12 args=["auth","login","--print-logs"] opencode
    INFO  2025-10-21T19:35:02 +0ms service=project directory=/home/simpa fromDirectory
    
    ┌  Add credential
    INFO  2025-10-21T19:35:02 +4ms service=models.dev file={} refreshing
    INFO  2025-10-21T19:35:03 +1119ms service=models.dev file={} refreshing
    │
    ◇  Select provider
    │  OpenCode Zen
    INFO  2025-10-21T19:35:05 +1444ms service=config path=/home/simpa/.config/opencode/config.json loading
    INFO  2025-10-21T19:35:05 +1ms service=config path=/home/simpa/.config/opencode/opencode.json loading
    INFO  2025-10-21T19:35:05 +0ms service=config path=/home/simpa/.config/opencode/opencode.jsonc loading
    INFO  2025-10-21T19:35:05 +4ms service=bun cmd=["/home/simpa/.npm-global/lib/node_modules/opencode-ai/node_modules/opencode-linux-x64/bin/opencode","add","@opencode-ai/plugin@0.15.12","--exact"] cwd=/home/simpa/.config/opencode running
    INFO  2025-10-21T19:35:05 +2ms service=plugin path=opencode-copilot-auth@0.0.3 loading plugin
    INFO  2025-10-21T19:35:05 +1ms service=bun pkg=opencode-copilot-auth version=0.0.3 installing package using Bun's default registry resolution
    INFO  2025-10-21T19:35:05 +0ms service=bun cmd=["/home/simpa/.npm-global/lib/node_modules/opencode-ai/node_modules/opencode-linux-x64/bin/opencode","add","--force","--exact","--cwd","/home/simpa/.cache/opencode","opencode-copilot-auth@0.0.3"] cwd=/home/simpa/.cache/opencode running
    INFO  2025-10-21T19:46:20 +675138ms service=bun code=0 stdout=bun add v1.3.0 (b0a6feca)
    
    installed opencode-copilot-auth@0.0.3
    
    1 package installed [675.13s]
     stderr=Resolving dependencies
    Resolved, downloaded and extracted [4]
    Saved lockfile
     done
    INFO  2025-10-21T19:46:20 +3ms service=plugin path=opencode-anthropic-auth@0.0.2 loading plugin
    INFO  2025-10-21T19:46:20 +2ms service=bun pkg=opencode-anthropic-auth version=0.0.2 installing package using Bun's default registry resolution
    INFO  2025-10-21T19:46:20 +0ms service=bun cmd=["/home/simpa/.npm-global/lib/node_modules/opencode-ai/node_modules/opencode-linux-x64/bin/opencode","add","--force","--exact","--cwd","/home/simpa/.cache/opencode","opencode-anthropic-auth@0.0.2"] cwd=/home/simpa/.cache/opencode running
    
  10. rekram1-node commented on Oct 21, 2025

    @rekram1-node
    Contributor

    I guess it's just taking it's time for whatever reason, we should probably add some visual indicator at some point

  11. Simpaqt commented on Oct 21, 2025

    @Simpaqt
    Author

    To be fair, i have had major issues with bun. But i'll just leave it running to see what happens.

  12. Eric-Guo commented on Nov 7, 2025

    @Eric-Guo
    Contributor

    I meet the same problm and the solution is using A modern terminal emulator (MacOS Terminal is not) or enter tmux first.

  13. greeze commented on Nov 22, 2025

    @greeze

    I had the same problem and was able to solve it by disabling IPv6 in my environment (I'm on ChromeOS and my linux environment isn't playing nice with IPv6). This appears to be a common problem with bun, and isn't OpenCode-related.

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingzenRelates to Zen

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions