Skip to content

Bug Report: Opencode Server Fails with ENOENT posix_spawn '/usr/bin/rg' When Directory Parameter is Provided #3158

@wojons

Description

@wojons

Bug Report: Opencode Server Fails with ENOENT posix_spawn '/usr/bin/rg' When Directory Parameter is Provided

Issue Description

When sending a message to an opencode session with a directory query parameter, the server attempts to spawn ripgrep (rg) but fails with ENOENT because rg is not available in the server's runtime environment (Docker container).

Without the directory parameter, the request succeeds.

Steps to Reproduce

  1. Start opencode server (running in Docker container).
  2. Create a session: curl -X POST "http://localhost:42423/session?directory=/path/to/dir" -H "Content-Type: application/json" -H "X-API-KEY: your_api_key" -d '{"title":"Test Session"}'
  3. Send a message with directory: curl -v -X POST "http://localhost:42423/session/{session_id}/message?directory=/path/to/dir" -H "Content-Type: application/json" -H "X-API-KEY: your_api_key" -d '{"parts":[{"type":"text","text":"Test message"}]}'

Expected Behavior

Message should be processed successfully, as it does without the directory parameter.

Actual Behavior

HTTP 400 Bad Request with error: {"name":"UnknownError","data":{"message":"Error: ENOENT: no such file or directory, posix_spawn '/usr/bin/rg'"}}

Failing Curl Command and Output

Command:

curl -v -X POST "http://localhost:42423/session/ses_61fb303adffepX31IYrwrNVLBu/message?directory=%2Fconfig%2Fworkspace%2Fwhatsapp-mcp%2Fwhatsapp-bridge%2Fstore%2Fsessions%2F14248351223-s.whatsapp.net-c8a203c244cfad1c" -H "Content-Type: application/json" -H "X-API-KEY: your_opencode_api_key_here" -d '{"parts":[{"type":"text","text":"You are a helpful AI assistant integrated with WhatsApp.\n\n[START BATCH]\n- Message ID: AC93D0E4BC3075B43E6845B07AC1AB58\n- Chat JID: 14248351223@s.whatsapp.net\n- Sender: 14248351223\n- Timestamp: 2025-10-14 03:19:25\n\nHhjjj"}]}'

Output:

* Host localhost:42423 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying [::1]:42423...
* connect to ::1 port 42423 from ::1 port 34442 failed: Connection refused
*   Trying 127.0.0.1:42423...
* Connected to localhost (127.0.0.1) port 42423
> POST /session/ses_61fb303adffepX31IYrwrNVLBu/message?directory=%2Fconfig%2Fworkspace%2Fwhatsapp-mcp%2Fwhatsapp-bridge%2Fstore%2Fsessions%2F14248351223-s.whatsapp.net-c8a203c244cfad1c HTTP/1.1
> Host: localhost:42423
> User-Agent: curl/8.5.0
> Accept: */*
> Content-Type: application/json
> X-API-KEY: your_opencode_api_key_here
> Content-Length: 264
> 
} [264 bytes data]
< HTTP/1.1 400 Bad Request
< Content-Type: application/json
< Access-Control-Allow-Origin: *
< Date: Tue, 14 Oct 2025 01:22:57 GMT
< Content-Length: 112
< 
{ [112 bytes data]

100   376  100   112  100   264  14490  34157 --:--:-- --:--:-- --:--:-- 53714
* Connection #0 to host localhost left intact
{"name":"UnknownError","data":{"message":"Error: ENOENT: no such file or directory, posix_spawn '/usr/bin/rg'"}}

Environment

  • Opencode server version: 0.15.1
  • Running in Docker container

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