Skip to content

Bug: opencode upgrade fails with 403 Forbidden due to GitHub API Rate Limit (lack of GITHUB_TOKEN/GH_TOKEN environment variable support) #36260

Description

@estudiochapunov

Describe the bug

Running opencode upgrade fails with an unexpected 403 HTTP status code when the GitHub API Rate Limit for unauthenticated requests from the client IP address is exhausted.

This happens because the upgrade command queries https://api.github.com/repos/anomalyco/opencode/releases/latest using an unauthenticated request (without passing authorization headers).

To Reproduce

  1. Exhaust the GitHub API rate limit for unauthenticated requests from your current IP (e.g., behind a residential CGNAT or a shared public gateway).
  2. Run:
    opencode upgrade
  3. Observe the output:
    ● Using method: curl
    Error: Unexpected error
    StatusCode: non 2xx status code (403 GET https://api.github.com/repos/anomalyco/opencode/releases/latest)
    

Expected behavior

The upgrade tool should check if standard industry environment variables GITHUB_TOKEN or GH_TOKEN are present in the shell environment. If found, it should inject them as an Authorization: token <TOKEN> header in its API requests to api.github.com.

This is standard practice for CLI utilities to leverage the higher authenticated rate limits (5,000 requests/hr) and avoid unauthenticated blockages on shared IPs.

Environment

  • OS: Linux Mint 21.3 (x86-64)
  • OpenCode Version: 1.17.15
  • Connection Method: curl

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