[PR #972] [MERGED] improve error handling and logging for GitHub API failures in upgrade and install script #9765

Closed
opened 2026-02-16 18:14:08 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opencode/pull/972
Author: @CodinCat
Created: 7/14/2025
Status: Merged
Merged: 7/14/2025
Merged by: @thdxr

Base: devHead: improve-upgrade-github-error-message


📝 Commits (2)

  • 15c2e63 improve error log for upgrade failures caused by GitHub API
  • 02dc8ed update the install script as well

📊 Changes

2 files changed (+8 additions, -2 deletions)

View changed files

📝 install (+1 -1)
📝 packages/opencode/src/installation/index.ts (+7 -1)

📄 Description

I encountered an error when running opencode upgrade. The log looked like this:

ERROR 2025-07-14T05:44:30 +115ms service=default name=TypeError message=undefined is not an object (evaluating 'q.tag_name.slice') fatal

It turned out that I was getting 429 from the GitHub API, probably because I was using a VPN.

With this change the log should provide the user with more useful information for troubleshooting and future debugging:

ERROR 2025-07-14T11:04:01 +2272ms service=installation message=API rate limit exceeded for xxx.xxx.xxx.xxx. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.) documentation_url=https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting GitHub API error
ERROR 2025-07-14T11:04:01 +1ms service=default name=Error message=failed to fetch latest version fatal

The install script had a similar issue. This is what I got when I tried to reinstall opencode. $specific_version is empty when the API has an error:

> curl -fsSL https://opencode.ai/install | bash
Version  already installed

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opencode/pull/972 **Author:** [@CodinCat](https://github.com/CodinCat) **Created:** 7/14/2025 **Status:** ✅ Merged **Merged:** 7/14/2025 **Merged by:** [@thdxr](https://github.com/thdxr) **Base:** `dev` ← **Head:** `improve-upgrade-github-error-message` --- ### 📝 Commits (2) - [`15c2e63`](https://github.com/anomalyco/opencode/commit/15c2e63092b5e2fea1f0cfa6e2e454af423629a6) improve error log for upgrade failures caused by GitHub API - [`02dc8ed`](https://github.com/anomalyco/opencode/commit/02dc8ed4f13a55f3aedf8fed550b72d47d1f9a50) update the install script as well ### 📊 Changes **2 files changed** (+8 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `install` (+1 -1) 📝 `packages/opencode/src/installation/index.ts` (+7 -1) </details> ### 📄 Description I encountered an error when running `opencode upgrade`. The log looked like this: ``` ERROR 2025-07-14T05:44:30 +115ms service=default name=TypeError message=undefined is not an object (evaluating 'q.tag_name.slice') fatal ``` It turned out that I was getting 429 from the GitHub API, probably because I was using a VPN. With this change the log should provide the user with more useful information for troubleshooting and future debugging: ``` ERROR 2025-07-14T11:04:01 +2272ms service=installation message=API rate limit exceeded for xxx.xxx.xxx.xxx. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.) documentation_url=https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting GitHub API error ERROR 2025-07-14T11:04:01 +1ms service=default name=Error message=failed to fetch latest version fatal ``` The install script had a similar issue. This is what I got when I tried to reinstall opencode. `$specific_version` is empty when the API has an error: ``` > curl -fsSL https://opencode.ai/install | bash Version already installed ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 18:14:08 -05:00
yindo closed this issue 2026-02-16 18:14:08 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9765