You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Grep tool fails on Windows: CRLF line ending not stripped from ripgrep path #5946
The built-in grep tool fails on Windows because it doesn't strip the carriage return (\r) from the ripgrep path returned by where rg.
Environment
OS: Windows 10/11
ripgrep version: 14.1.0
ripgrep location:C:\ProgramData\chocolatey\bin\rg.exe (installed via Chocolatey)
Steps to Reproduce
Have ripgrep installed on Windows (via Chocolatey, Scoop, or Winget)
Use the grep tool in opencode
Expected Behavior
Grep tool finds and executes ripgrep successfully.
Actual Behavior
Error: Executable not found in $PATH: "C:\ProgramData\chocolatey\bin\rg.exe\r"
Note the \r at the end of the path.
Root Cause
The grep tool appears to run where rg to locate ripgrep on Windows. Windows returns paths with CRLF line endings (\r\n). The tool strips \n but leaves the \r, resulting in an invalid path.
Evidence:
> where rg
C:\ProgramData\chocolatey\bin\rg.exe\r\n
C:\Users\Hamza\AppData\Local\Microsoft\WinGet\Links\rg.exe\r\n
Suggested Fix
When parsing the output of where rg on Windows, strip both \r and \n:
Activity
github-actions commentedon Dec 22, 2025
This issue might be a duplicate of existing issues. Please check:
All three issues involve Windows-specific ripgrep path resolution failures. Feel free to ignore if your specific case differs from these.