Skip to content

Fresh brew install asks for Github Copilot API key #1154

Description

@381181295

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

Activity

  1. self-assigned this
    on Jul 20, 2025
  2. zacharyeller13 commented on Jul 24, 2025

    @zacharyeller13

    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.

  3. Clete2 commented on Aug 7, 2025

    @Clete2

    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.

  4. rekram1-node commented on Dec 28, 2025

    @rekram1-node
    Collaborator

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

  5. hulius commented on Jan 12, 2026

    @hulius

    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.

  6. rekram1-node commented on Jan 12, 2026

    @rekram1-node
    Collaborator

    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 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