Skip to content

Windows Desktop installer is broken offline: ripgrep not bundled, core tools (grep, glob, skill) and built-in skill (customize-opencode) fail #34442

Closed as duplicate

Description

@vokasug

Description

On any machine without internet access, OpenCode Desktop is effectively broken right out of the box. Three core built-in tools (grep, glob, skill) and the built-in customize-opencode skill all depend on ripgrep internally. When ripgrep is absent and cannot be downloaded, all of these fail with ripgrep execution failed.

This makes OpenCode nearly unusable offline -- you lose content search, file discovery, and all skill loading (including the only built-in skill that tells users how to configure OpenCode).

Root cause

OpenCode does not bundle ripgrep. On first run it tries to download rg from GitHub Releases into ~/.cache/opencode/bin/. If the download fails (offline machine, firewall, proxy), the cache stays empty and OpenCode never falls back to a system-installed ripgrep in PATH -- it just fails.

Steps to reproduce

  1. Install OpenCode Desktop on a Windows machine without internet
  2. Open a project
  3. Try to use any skill: skill("customize-opencode")
  4. Observe: ripgrep execution failed
  5. Same for grep and glob tools

Impact

  • grep tool -- broken (content search)
  • glob tool -- broken (file discovery)
  • skill tool -- broken (skill loading, including customize-opencode)
  • customize-opencode built-in skill -- unloadable (users cannot even read config docs)

This is especially critical for air-gapped enterprise environments and CI runners.

Suggested fix

Bundle ripgrep directly in the Windows NSIS installer (and macOS DMG, Linux packages). Ripgrep is a single statically-linked binary. The Windows x64 release of ripgrep 14.1.1 is ~4.5 MB uncompressed (~1.5 MB compressed). For a Desktop installer that is already 100+ MB, this is negligible.

Workaround (for affected users)

Copy rg.exe to any directory in PATH (e.g. C:\Windows\System32\) and restart OpenCode. OpenCode detects and uses the system ripgrep when available.

Related

Activity

  1. github-actions commented on Jun 29, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your issue adds new information (e.g. specific to the Windows NSIS Desktop installer), feel free to keep it open and link the above for context. Otherwise, consider commenting on or upvoting the existing issues.

  2. Max-Null commented on Jul 25, 2026

    @Max-Null

    补充一个更具体的根因分析——我在 Windows 11 (在线环境) 上复现了这个问题,并通过解包 app.asar + 日志分析找到了下载失败的具体原因:

    补充发现:在线环境也会失败

    即使在有网络的 Windows 上,OpenCode Desktop 的 ripgrep 自动下载也静默失败了。日志证明:

    # 我的日志中出现了 20+ 次重复下载,每次启动都重试
    timestamp=2026-07-05T07:23:06.415Z level=INFO message="downloading ripgrep" url=...
    timestamp=2026-07-25T08:32:18.213Z level=INFO message="downloading ripgrep" url=...
    ... (20+ 条)
    

    根因:Path.bin 目录不存在

    查看 app.asar 中的 RipgrepBinary 服务代码,ripgrep 的解析逻辑是 3 步回退:

    1. which2("rg.exe") → 系统 PATH → 找不到
    2. ~/.cache/bin/rg.exe → OpenCode 自己的 bin 目录 → 目录不存在
    3. 从 GitHub 下载 → 解压到 Path.bin → 父目录不存在,解压静默失败

    关键是第 3 步中的:

    const dir2 = yield* fs52.makeTempDirectoryScoped({ 
      directory: exports_global.Path.bin,  // "~/.cache/bin" → 目录不存在
      prefix: "ripgrep-" 
    });

    其中 Path.bin = path.join(xdgCache, "bin"),在 Windows 上解析为 C:\Users\<user>\.cache\bin。这个目录在全新安装 OpenCode 后不存在。

    两个独立的 Bug

    Bug A: 下载 → 解压流程没有预先创建 ~/.cache/bin/ 目录(缺一行 mkdir -p)

    Bug B: 失败后没有缓存失败状态,每次启动都重新下载 ~4MB(日志里 20+ 次重复下载就是证据)

    建议

    即使将来捆绑了 ripgrep,也应该修复 Bug A——因为自动下载是正常的 fallback 路径,不能因为一个目录不存在就静默失败 20+ 次。

  3. TheMasterFX commented on Sep 13, 2026

    @TheMasterFX

    Will it ever happen that ripgrep is buildin in the binary builds?

  4. neriousy commented on Oct 1, 2026

    @neriousy
    Member

    Closing as a duplicate of #31734, which tracks bundling ripgrep in the binary builds so grep, glob and skills work offline. Please add your use case and 👍 there.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions