socket connection error with ProxyChains from v1.0.0 #2831

Open
opened 2026-02-16 17:37:26 -05:00 by yindo · 8 comments
Owner

Originally created by @francois-le-suisse on GitHub (Nov 13, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

Since v1.0.0, starting opencode with proxychains crash with error:
[ERROR] Error: The socket connection was closed unexpectedly. For more information, pass 'verbose: true' in the second argument to fetch()

Reverting to 0.15.31 fixes the problem.

OpenCode version

v1.0.0 and beyond

Steps to reproduce

  1. Use proxychains with a basic settings
strict_chain
quiet_mode
proxy_dns
tcp_read_time_out 15000
tcp_connect_time_out 8000
[ProxyList]
socks4  127.0.0.1 9050```
2. Start opencode with proxychains
`proxychains $HOME/.opencode/bin/opencode



### Screenshot and/or share link

_No response_

### Operating System

_No response_

### Terminal

Windows Terminal Running a debian based docker container (pivert/seashell)
Originally created by @francois-le-suisse on GitHub (Nov 13, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description Since v1.0.0, starting opencode with proxychains crash with error: `[ERROR] Error: The socket connection was closed unexpectedly. For more information, pass 'verbose: true' in the second argument to fetch()` Reverting to 0.15.31 fixes the problem. ### OpenCode version v1.0.0 and beyond ### Steps to reproduce 1. Use proxychains with a basic settings ```rg -v '^(#|$)' /etc/proxychains.conf --no-line-number strict_chain quiet_mode proxy_dns tcp_read_time_out 15000 tcp_connect_time_out 8000 [ProxyList] socks4 127.0.0.1 9050``` 2. Start opencode with proxychains `proxychains $HOME/.opencode/bin/opencode ### Screenshot and/or share link _No response_ ### Operating System _No response_ ### Terminal Windows Terminal Running a debian based docker container (pivert/seashell)
yindo added the bug label 2026-02-16 17:37:26 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Nov 13, 2025):

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

  • #3511: Same "socket connection was closed unexpectedly" error message with same suggested fix (pass verbose: true)
  • #1692: Identical error message "The socket connection was closed unexpectedly. For more information, pass verbose: true in the second argument to fetch()"
  • #531: General HTTP_PROXY & HTTPS_PROXY support request for users behind firewalls and proxy setups
  • #2446: AWS Bedrock provider proxy support issue, showing broader proxy configuration problems

Feel free to ignore if none of these address your specific ProxyChains case.

@github-actions[bot] commented on GitHub (Nov 13, 2025): This issue might be a duplicate of existing issues. Please check: - #3511: Same "socket connection was closed unexpectedly" error message with same suggested fix (pass verbose: true) - #1692: Identical error message "The socket connection was closed unexpectedly. For more information, pass `verbose: true` in the second argument to fetch()" - #531: General HTTP_PROXY & HTTPS_PROXY support request for users behind firewalls and proxy setups - #2446: AWS Bedrock provider proxy support issue, showing broader proxy configuration problems Feel free to ignore if none of these address your specific ProxyChains case.
Author
Owner

@burbilog commented on GitHub (Nov 18, 2025):

The same is here -- 1.0.76 does not work with proxychains. My error is a little different though:

%proxychains opencode
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.17
{"code":"FailedToOpenSocket","path":"http://127.0.0.1:38265/config/providers","errno":0}

Proxychains is a horrible hack, but unfortunately, Opencode does not support proxy at all. Had Opencode supported any kind of proxy, there would be no need for this hack.

Other programs work with the same proxychains on this machine just fine.

@burbilog commented on GitHub (Nov 18, 2025): The same is here -- 1.0.76 does not work with proxychains. My error is a little different though: ~~~ %proxychains opencode [proxychains] config file found: /etc/proxychains4.conf [proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4 [proxychains] DLL init: proxychains-ng 4.17 {"code":"FailedToOpenSocket","path":"http://127.0.0.1:38265/config/providers","errno":0} ~~~ Proxychains is a horrible hack, but unfortunately, Opencode does not support proxy at all. Had Opencode supported any kind of proxy, there would be no need for this hack. Other programs work with the same proxychains on this machine just fine.
Author
Owner

@rekram1-node commented on GitHub (Nov 19, 2025):

ill take a look

@rekram1-node commented on GitHub (Nov 19, 2025): ill take a look
Author
Owner

@frap129 commented on GitHub (Nov 19, 2025):

This could be related to #3868 , which is an error caused when trying to use HTTP_PROXY env vars to configure a proxy.

@frap129 commented on GitHub (Nov 19, 2025): This could be related to #3868 , which is an error caused when trying to use HTTP_PROXY env vars to configure a proxy.
Author
Owner

@rekram1-node commented on GitHub (Nov 19, 2025):

yup definitely

@rekram1-node commented on GitHub (Nov 19, 2025): yup definitely
Author
Owner

@burbilog commented on GitHub (Dec 12, 2025):

Now attempts to run opencode via proxychains result in this:

pts/19%proxychains opencode 
ProxyChains-3.1 (http://proxychains.sf.net)
Error: Was there a typo in the url or port?

Opencode 1.0.150

Please, please fix either this bug or support regular HTTP_PROXY variable...

@burbilog commented on GitHub (Dec 12, 2025): Now attempts to run opencode via proxychains result in this: ~~~ pts/19%proxychains opencode ProxyChains-3.1 (http://proxychains.sf.net) Error: Was there a typo in the url or port? ~~~ Opencode 1.0.150 Please, please fix either this bug or support regular HTTP_PROXY variable...
Author
Owner

@rekram1-node commented on GitHub (Dec 13, 2025):

Opencode does respect HTTP_PROXY and HTTPS_PROXY vars, you will probably also need to set:
NO_PROXY=localhost,127.0.0.1
and
NODE_EXTRA_CA_CERTS=/path/to/ca-cert.pem

@rekram1-node commented on GitHub (Dec 13, 2025): Opencode does respect HTTP_PROXY and HTTPS_PROXY vars, you will probably also need to set: `NO_PROXY=localhost,127.0.0.1` and `NODE_EXTRA_CA_CERTS=/path/to/ca-cert.pem`
Author
Owner

@rekram1-node commented on GitHub (Dec 13, 2025):

ill document everything

@rekram1-node commented on GitHub (Dec 13, 2025): ill document everything
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2831