From 520d50bad61efe2337cae516b888445d4fb64cfb Mon Sep 17 00:00:00 2001 From: jxl <8534661+XiaoleiJia1005@users.noreply.github.com> Date: Thu, 9 Apr 2026 16:01:23 +0800 Subject: [PATCH] fix: catch exception from fetch call when download Ripgrep binary --- packages/opencode/src/file/ripgrep.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/opencode/src/file/ripgrep.ts b/packages/opencode/src/file/ripgrep.ts index 601c82e94f5e..db843b508219 100644 --- a/packages/opencode/src/file/ripgrep.ts +++ b/packages/opencode/src/file/ripgrep.ts @@ -145,7 +145,10 @@ export namespace Ripgrep { const filename = `ripgrep-${version}-${config.platform}.${config.extension}` const url = `https://github.com/BurntSushi/ripgrep/releases/download/${version}/${filename}` - const response = await fetch(url) + const response = await fetch(url).catch((error:any) => { + log.error(`Failed to download ripgrep from URL:${url}, error:${error?.message ?? String(error)}`) + throw new DownloadFailedError({ url, status: -1 }) + }) if (!response.ok) throw new DownloadFailedError({ url, status: response.status }) const arrayBuffer = await response.arrayBuffer()