Fresh brew install asks for Github Copilot API key #816

Closed
opened 2026-02-16 17:28:27 -05:00 by yindo · 5 comments
Owner

Originally created by @381181295 on GitHub (Jul 19, 2025).

Originally assigned to: @thdxr on GitHub.

Description: Fresh install asks for a GH Copilot API key instead of providing a link to the auth flow.

OS: Mac

Steps to reproduce:

  1. Intsall opencode using brew
  2. Exec opencode auth login

Expected Results: Returns a link to complete the auth flow, and the security code.
Actual results: Asks for GH Copilot API key

Image
Originally created by @381181295 on GitHub (Jul 19, 2025). Originally assigned to: @thdxr on GitHub. Description: Fresh install asks for a GH Copilot API key instead of providing a link to the auth flow. OS: Mac Steps to reproduce: 1. Intsall opencode using brew 2. Exec `opencode auth login` Expected Results: Returns a link to complete the auth flow, and the security code. Actual results: Asks for GH Copilot API key <img width="840" height="676" alt="Image" src="https://github.com/user-attachments/assets/5e583d18-a6f4-43d4-9337-03332de858fb" />
yindo closed this issue 2026-02-16 17:28:27 -05:00
Author
Owner

@zacharyeller13 commented on GitHub (Jul 24, 2025):

Check and see if ~/.local/state/opencode/plugin/copilot.ts exists on your system. Experienced the same issue and was able to fix it by copying that file over from one of my Linux machines where OAuth login is working.

@zacharyeller13 commented on GitHub (Jul 24, 2025): Check and see if `~/.local/state/opencode/plugin/copilot.ts` exists on your system. Experienced the same issue and was able to fix it by copying that file over from one of my Linux machines where OAuth login is working.
Author
Owner

@Clete2 commented on GitHub (Aug 7, 2025):

I'm having the same issue. I do not have the file @zacharyeller13 mentioned. Completely fresh install from NPM.

I can't get it to prompt me for auth device flow at all, it always prompts for API key.

Edit: Setting "NODE_TLS_REJECT_UNAUTHORIZED=0" fixes this issue for me. It is due to corporate proxy. See #1694 for an issue asking for local trust store support.

@Clete2 commented on GitHub (Aug 7, 2025): I'm having the same issue. I do not have the file @zacharyeller13 mentioned. Completely fresh install from NPM. I can't get it to prompt me for auth device flow at all, it always prompts for API key. Edit: Setting "NODE_TLS_REJECT_UNAUTHORIZED=0" fixes this issue for me. It is due to corporate proxy. See #1694 for an issue asking for local trust store support.
Author
Owner

@rekram1-node commented on GitHub (Dec 27, 2025):

[automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!

@rekram1-node commented on GitHub (Dec 27, 2025): [automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!
Author
Owner

@hulius commented on GitHub (Jan 12, 2026):

I got the same issue (API key asked for Github Copilot) but it was due to a different root cause (silent failure to install npm deps).

Because of a custom npm registry configured on my side, the attempts to install the deps were getting 401 but I was getting 0 error on the UI so I did not know that something was wrong. Like described in this ticket I was then unable, to login to Github Copilot because it was asking for an API key.

Once I fixed my npm registry, everything went like a charm.

I'm guessing that the errors are not caught, that's why there is no error message on the UI. Maybe a good fix would be to display an error message when that happens?

Here's an extract of the logs, showing the 401.

INFO 2026-01-12T12:25:29 +110ms service=bun code=1 s
stdout=bun add v1.3.5 (1e86cebd)
stderr=Resolving dependencies
Resolved, downloaded and extracted [1]
error: GET https://<CUSTOM_NPM_REGISTRY>/@opencode-ai%2fplugin - 401
done
INFO 2026-01-12T12:25:29 +0ms service=bun cmd=["/opt/homebrew/Cellar/opencode/1.1.14/bin/opencode","install"] cwd=/Users/hulius/.config/opencode running
INFO 2026-01-12T12:25:29 +6ms service=bun code=1 stdout=bun add v1.3.5 (1e86cebd)
stderr=Resolving dependencies
Resolved, downloaded and extracted [1]
error: GET https://<CUSTOM_NPM_REGISTRY>/opencode-copilot-auth - 401
done

I'm on MacOS, v1.1.14 installed with Homebrew.

@hulius commented on GitHub (Jan 12, 2026): I got the same issue (API key asked for Github Copilot) but it was due to a different root cause (silent failure to install npm deps). Because of a custom npm registry configured on my side, the attempts to install the deps were getting 401 but I was getting 0 error on the UI so I did not know that something was wrong. Like described in this ticket I was then unable, to login to Github Copilot because it was asking for an API key. Once I fixed my npm registry, everything went like a charm. **I'm guessing that the errors are not caught, that's why there is no error message on the UI. Maybe a good fix would be to display an error message when that happens?** Here's an extract of the logs, showing the 401. > INFO 2026-01-12T12:25:29 +110ms service=bun code=1 s > stdout=bun add v1.3.5 (1e86cebd) > stderr=Resolving dependencies > Resolved, downloaded and extracted [1] > error: GET https://<CUSTOM_NPM_REGISTRY>/@opencode-ai%2fplugin - 401 > done > INFO 2026-01-12T12:25:29 +0ms service=bun cmd=["/opt/homebrew/Cellar/opencode/1.1.14/bin/opencode","install"] cwd=/Users/hulius/.config/opencode running > INFO 2026-01-12T12:25:29 +6ms service=bun code=1 stdout=bun add v1.3.5 (1e86cebd) > stderr=Resolving dependencies > Resolved, downloaded and extracted [1] > error: GET https://<CUSTOM_NPM_REGISTRY>/opencode-copilot-auth - 401 > done I'm on MacOS, v1.1.14 installed with Homebrew.
Author
Owner

@rekram1-node commented on GitHub (Jan 12, 2026):

I'm guessing that the errors are not caught, that's why there is no error message on the UI. Maybe a good fix would be to display an error message when that happens?

YES

@rekram1-node commented on GitHub (Jan 12, 2026): > I'm guessing that the errors are not caught, that's why there is no error message on the UI. Maybe a good fix would be to display an error message when that happens? YES
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#816