Skip to content

fix: handle GitHub API rate limits in install scripts#350

Open
brycelelbach wants to merge 1 commit intobrevdev:mainfrom
brycelelbach:fix/install-script-rate-limit-handling
Open

fix: handle GitHub API rate limits in install scripts#350
brycelelbach wants to merge 1 commit intobrevdev:mainfrom
brycelelbach:fix/install-script-rate-limit-handling

Conversation

@brycelelbach
Copy link
Copy Markdown

Summary

  • The install scripts (bin/install-latest.sh, bin/install-latest-linux.sh) use curl -s to fetch release metadata from the GitHub API. The -s flag silently swallows HTTP errors, so when the API returns a 403 (rate limit) or any other failure, the scripts either print a misleading "Could not find release" error or, in the case of install-latest-linux.sh, proceed with an empty download URL.
  • Switch to curl -sf so HTTP errors produce a non-zero exit code, and add explicit error handling with a clear message about rate limiting.
  • Add a missing empty-URL guard to install-latest-linux.sh.

Test plan

  • Run bin/install-latest.sh normally and verify it still installs successfully.
  • Simulate a GitHub API rate limit (e.g. exhaust unauthenticated quota) and verify the script exits with a clear error message mentioning rate limiting.
  • Run bin/install-latest-linux.sh on a Linux host and verify the same behavior.

The install scripts used `curl -s` which silently swallows HTTP errors.
When the GitHub API returns a 403 (rate limit) or other failure, the
scripts would either print a misleading "Could not find release" error
or, in the case of install-latest-linux.sh, proceed with an empty URL.

Switch to `curl -sf` so HTTP errors produce a non-zero exit code, and
add explicit error handling with a clear message about rate limiting.
Also add a missing empty-URL guard to install-latest-linux.sh.
@brycelelbach brycelelbach requested a review from a team as a code owner April 8, 2026 14:00
Copilot AI review requested due to automatic review settings April 8, 2026 14:00
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# Fetch release metadata from GitHub API
API_RESPONSE="$(curl -sf https://api.github.com/repos/brevdev/brev-cli/releases/latest 2>&1)" || {
echo "Error: Failed to fetch release info from GitHub API." >&2
echo "This may be caused by rate limiting. Try again later or set a GITHUB_TOKEN." >&2
Copy link
Copy Markdown
Contributor

@patelspratik patelspratik Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does setting a GITHUB_TOKEN work? we don't utilize it anywhere, right? Wouldn't the curl need to conditionally check for it?

Also, since the people who see this the most are likely on a VPN:

echo "Error: Failed to fetch release info from GitHub API." >&2
echo "This is often caused by rate limiting when many requests come from the same IP." >&2
echo "If you are using a VPN, try turning it off and running this script again." >&2
echo "For more details, see: https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting" >&2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants