Skip to content

fix(ripgrep): surface network errors as RipgrepDownloadFailedError#21748

Closed
YGoetschel wants to merge 1 commit intoanomalyco:devfrom
YGoetschel:fix/ripgrep-download-network-error
Closed

fix(ripgrep): surface network errors as RipgrepDownloadFailedError#21748
YGoetschel wants to merge 1 commit intoanomalyco:devfrom
YGoetschel:fix/ripgrep-download-network-error

Conversation

@YGoetschel
Copy link
Copy Markdown

Issue for this PR

Closes #21646

Type of change

  • Bug fix

What does this PR do?

fetch(url) can throw when the machine is offline or can't reach GitHub — but the error was not caught. The raw Bun/Node network exception propagated up, surfacing in the TUI as the unhelpful message "Unable to connect. Is the computer able to access the url?".

DownloadFailedError already exists for exactly this case but was only used for non-2xx HTTP responses. This change adds a .catch() that converts fetch network errors into DownloadFailedError with status: 0, so both paths (network failure and bad HTTP status) produce the same typed error.

How did you verify your code works?

Code review — the fix is minimal and follows the existing error pattern. In an offline environment, the fetch() promise rejects and the catch converts it to DownloadFailedError.

Screenshots / recordings

No UI screenshots — error message improvement in tool output.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

When fetch() throws (e.g. offline/no network), the raw runtime error
was bubbling up, showing the confusing 'Unable to connect' message
in the TUI rather than a meaningful error.

Catching the network exception and rethrowing as DownloadFailedError
lets the LLM and user understand what actually went wrong.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 9, 2026

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate Found:

Recommendation: Check if PR #21649 is still open and if it covers the same scope (converting fetch errors to DownloadFailedError with status: 0).

@YGoetschel YGoetschel closed this Apr 9, 2026
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.

Improve error handling for Ripgrep binary download in offline environments

1 participant