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
- Exhaust the GitHub API rate limit for unauthenticated requests from your current IP (e.g., behind a residential CGNAT or a shared public gateway).
- Run:
- 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
Describe the bug
Running
opencode upgradefails 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/latestusing an unauthenticated request (without passing authorization headers).To Reproduce
Expected behavior
The upgrade tool should check if standard industry environment variables
GITHUB_TOKENorGH_TOKENare present in the shell environment. If found, it should inject them as anAuthorization: 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