OpenCode 1.1.2 ignores system proxy environment variables (HTTP_PROXY/HTTPS_PROXY) #4239

Closed
opened 2026-02-16 17:43:08 -05:00 by yindo · 2 comments
Owner

Originally created by @Lycidas97 on GitHub (Jan 5, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

Environment:

  • OpenCode Version: 1.1.2
  • Node.js Version: v22.20.0
  • OS: Linux
  • Proxy Software: v2ray (running at 10.71.115.178:10808)

Current Configuration (env):

HTTPS_PROXY=http://10.71.115.178:10808
HTTP_PROXY=http://10.71.115.178:10808
NO_PROXY=localhost,127.0.0.1,
http_proxy=http://10.71.115.178:10808
https_proxy=http://10.71.115.178:10808
no_proxy=localhost,127.0.0.1,

Problem Description:
Despite having proxy environment variables correctly configured, OpenCode appears to bypass the proxy and attempts direct connections.

  1. v2ray logs: No connection requests from OpenCode were observed in the v2ray proxy logs during execution.
  2. Standard tools: Tools like curl work correctly with the same proxy settings.
  3. Execution error: The command fails with a timeout when trying to reach external services.

Steps to Reproduce:

opencode run hello --print-logs

Actual Logs:

INFO  service=llm providerID=opencode modelID=gpt-5-nano sessionID=... agent=title stream
...
ERROR 2026-01-05T15:00:50 +9642ms service=models.dev error=The operation timed out. Failed to fetch models.dev

Evidence (Network Trace):
Using strace -f -e trace=connect, it was confirmed that the binary attempts direct connections to external IPs (e.g., 104.26.x.x, 172.65.x.x) on port 443 instead of routing through the proxy at 10.71.115.178:10808.

Expected Behavior:
OpenCode should recognize system proxy variables and route all network traffic through the configured proxy.

Plugins

No custom plugins installed. Logs show default plugins (opencode-copilot-auth, opencode-anthropic-auth) being loaded during the bootstrap process.

OpenCode version

1.1.2

Steps to reproduce

  1. Setup a Linux environment with a mandatory HTTP/HTTPS proxy.
  2. Export proxy environment variables.
  3. Run opencode run hello --print-logs.
  4. Observe timeout errors and no traffic in the proxy software logs.

Screenshot and/or share link

No response

Operating System

Linux

Terminal

Bash

Originally created by @Lycidas97 on GitHub (Jan 5, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description **Environment:** * **OpenCode Version:** 1.1.2 * **Node.js Version:** v22.20.0 * **OS:** Linux * **Proxy Software:** v2ray (running at `10.71.115.178:10808`) **Current Configuration (env):** ```bash HTTPS_PROXY=http://10.71.115.178:10808 HTTP_PROXY=http://10.71.115.178:10808 NO_PROXY=localhost,127.0.0.1, http_proxy=http://10.71.115.178:10808 https_proxy=http://10.71.115.178:10808 no_proxy=localhost,127.0.0.1, ``` **Problem Description:** Despite having proxy environment variables correctly configured, OpenCode appears to bypass the proxy and attempts direct connections. 1. **v2ray logs:** No connection requests from OpenCode were observed in the v2ray proxy logs during execution. 2. **Standard tools:** Tools like `curl` work correctly with the same proxy settings. 3. **Execution error:** The command fails with a timeout when trying to reach external services. **Steps to Reproduce:** ```bash opencode run hello --print-logs ``` **Actual Logs:** ```text INFO service=llm providerID=opencode modelID=gpt-5-nano sessionID=... agent=title stream ... ERROR 2026-01-05T15:00:50 +9642ms service=models.dev error=The operation timed out. Failed to fetch models.dev ``` **Evidence (Network Trace):** Using `strace -f -e trace=connect`, it was confirmed that the binary attempts direct connections to external IPs (e.g., `104.26.x.x`, `172.65.x.x`) on port 443 instead of routing through the proxy at `10.71.115.178:10808`. **Expected Behavior:** OpenCode should recognize system proxy variables and route all network traffic through the configured proxy. ### Plugins No custom plugins installed. Logs show default plugins (`opencode-copilot-auth`, `opencode-anthropic-auth`) being loaded during the bootstrap process. ### OpenCode version 1.1.2 ### Steps to reproduce 1. Setup a Linux environment with a mandatory HTTP/HTTPS proxy. 2. Export proxy environment variables. 3. Run `opencode run hello --print-logs`. 4. Observe timeout errors and no traffic in the proxy software logs. ### Screenshot and/or share link *No response* ### Operating System Linux ### Terminal Bash
yindo added the bug label 2026-02-16 17:43:08 -05:00
yindo closed this issue 2026-02-16 17:43:08 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 5, 2026):

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

  • #531: Support HTTP_PROXY & HTTPS_PROXY for millions of users who are behind firewalls
  • #4959: Add option to disable models.dev fetch for corporate proxy environments
  • #4284: Socket connection error with ProxyChains from v1.0.0
  • #3989: acp-command unhandled rejection (also related to proxy handling)
  • #5749: Error launching TUI with proxy
  • #5414: Unable to start with VPN/proxy enabled
  • #6052: BunInstallFailederror on First Run (related to proxy environment variables)

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

@github-actions[bot] commented on GitHub (Jan 5, 2026): This issue might be a duplicate of existing issues. Please check: - #531: Support HTTP_PROXY & HTTPS_PROXY for millions of users who are behind firewalls - #4959: Add option to disable models.dev fetch for corporate proxy environments - #4284: Socket connection error with ProxyChains from v1.0.0 - #3989: acp-command unhandled rejection (also related to proxy handling) - #5749: Error launching TUI with proxy - #5414: Unable to start with VPN/proxy enabled - #6052: BunInstallFailederror on First Run (related to proxy environment variables) Feel free to ignore if none of these address your specific case.
Author
Owner

@Lycidas97 commented on GitHub (Jan 5, 2026):

Resolved: The issue was caused by a trailing comma in the no_proxy variable and the fact that OpenCode only respects lowercase proxy environment variables (e.g., https_proxy) while ignoring uppercase ones.

@Lycidas97 commented on GitHub (Jan 5, 2026): Resolved: The issue was caused by a trailing comma in the no_proxy variable and the fact that OpenCode only respects lowercase proxy environment variables (e.g., https_proxy) while ignoring uppercase ones.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4239