Skip to content

Improve error handling for Ripgrep binary download in offline environments #21646

@XiaoleiJia1005

Description

@XiaoleiJia1005

Description

Description
When using the Glob tool in an offline environment where ripgrep is not pre-installed, the agent fails with an confusing error message in the TUI:

✱ Glob "xxxx.ts" 
Unable to connect. Is the computer able to access the url?

Root Cause
The message is confusing for both users and the LLM. Based on the source code, the root cause is an unhandled exception thrown by the fetch call when it attempts to download the ripgrep binary from GitHub. Currently, the raw network exception from the runtime (Bun) is being bubbled up directly to the UI.

Proposed Solution
Adding a proper .catch() handler around the fetch call responsible for downloading the binary to capture the network exception.
Log the specific target URL that failed to download for debugging purposes.
Throw the existing error RipgrepDownloadFailedError.

Expected Behavior
After the fix, the user (and the LLM) should see a more descriptive error:

✱ Glob "xxxx.ts" 
RipgrepDownloadFailedError

Why this is better
This error information allows the LLM to make better decisions for its next step—such as attempting a retry, switching to a different tool, or informing the user to install ripgrep manually.

Plugins

No

OpenCode version

v1.3.13

Steps to reproduce

  1. no Ripgrep installed
  2. ask agent to use Glob to check file existence

Screenshot and/or share link

No response

Operating System

Windows11

Terminal

Windows Terminal

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions