Skip to content

The "gigacode" cli doesn't wait for underlying daemons to finish starting before trying to connect. Error: 'failed to proxy to native opencode' #162

@Taytay

Description

@Taytay

I just stumbled across gigacode and installed it on a pretty fresh machine (new sprite from https://sprites.dev), and it didn't work right out of the gate:

gigacode startup: ensuring daemon at http://127.0.0.1:2468 (token: unset, proxy env: unset, no_proxy env: unset)
  checking daemon health at http://127.0.0.1:2468 (token: unset)...
  ts=2026-02-11T16:47:06.401436533Z level=warn target=sandbox_agent::daemon message="daemon health check request failed" error="error sending request for url (http://127.0.0.1:2468/v1/health): error
  trying to connect: tcp connect error: Connection refused (os error 111)" elapsed_ms=13
  ts=2026-02-11T16:47:06.413920819Z level=warn target=sandbox_agent::daemon message="daemon health check request failed" error="error sending request for url (http://127.0.0.1:2468/v1/health): error
  trying to connect: tcp connect error: Connection refused (os error 111)" elapsed_ms=10
  starting daemon at http://127.0.0.1:2468 (logs: /home/sprite/.local/share/sandbox-agent/daemon/daemon-127-0-0-1-2468.log)
  ts=2026-02-11T16:47:06.662515937Z level=info target=sandbox_agent::daemon message="daemon became healthy while waiting" attempts=2 elapsed_ms=202
  daemon started (PID 49, logs: /home/sprite/.local/share/sandbox-agent/daemon/daemon-127-0-0-1-2468.log)
  gigacode startup: daemon is healthy
  gigacode startup: attaching OpenCode without precreating a session
  gigacode startup: resolving OpenCode binary (installing if needed)
  gigacode startup: launching OpenCode attach using /home/sprite/.local/share/sandbox-agent/bin/opencode
  ^[[?0u^[[1;1R{
    "data": {},
    "errors": [
      {
        "message": "failed to proxy to native opencode: error sending request for url (http://127.0.0.1:4200/config): error trying to connect: tcp connect error: Connection refused (os error 111)"
      }
    ],
    "success": false
  }

A bit of debugging, and Claude tells me that it's doing this:

  1. Starts the sandbox-agent daemon (port 2468)
  2. The daemon lazily starts opencode serve (port 4200) on first request
  3. The TUI connects and immediately requests /opencode/config
  4. The daemon tries to proxy to the opencode server, but it hasn't finished starting yet → "Connection refused"

That certainly sounds plausible to me. I haven't confirmed. If you'd like me to dig further and open a PR, lemme know.

Metadata

Metadata

Assignees

No one assigned

    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