Opencode not respecting NO_PROXY variable #6430

Open
opened 2026-02-16 18:04:11 -05:00 by yindo · 3 comments
Owner

Originally created by @anand2312 on GitHub (Jan 16, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

Running behind a corporate proxy, I have set the HTTP_PROXY, HTTPS_PROXY and NO_PROXY variables as described here

HTTP_PROXY=http://proxy.org.com
HTTPS_PROXY=http://proxy.org.com
NO_PROXY=*.org.com,localhost,127.0.0.1

I need the proxy variables set so that the global npm registry is accessible to install opencode's necessary plugins from, BUT I need opencode to connect to a local LiteLLM proxy as the LLM provider, running on (say) litellm.org.com:4000. My org requires that internal traffic should not be sent through the proxy, which is why I have *.org.com in my NO_PROXY. This setup works for every other application I use (including claude code)

Opencode seems to be routing the requests to LiteLLM also through the proxy, the log files include the error message that my org's proxy returns when you try reaching some internal endpoint through it.
Removing the HTTP_PROXY/HTTPS_PROXY in turn ends up working, but is just a band-aid fix

Plugins

No response

OpenCode version

1.1.23

Steps to reproduce

No response

Screenshot and/or share link

2026-01-16T063149.log

log including the error from my proxy server

Proxy variables set:

PS C:\Users\user> Get-ChildItem Env:*_PROXY

Name                           Value
----                           -----
NO_PROXY                       *.org.com,localhost,127.0.0.1
HTTPS_PROXY                    http://proxy.org.com:80
ALL_PROXY                      http://proxy.org.com:80
HTTP_PROXY                    http://proxy.org.com:80

Operating System

Windows 11

Terminal

Windows Terminal, Alacritty

Originally created by @anand2312 on GitHub (Jan 16, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description Running behind a corporate proxy, I have set the HTTP_PROXY, HTTPS_PROXY and NO_PROXY variables as described [here](https://opencode.ai/docs/network/) ``` HTTP_PROXY=http://proxy.org.com HTTPS_PROXY=http://proxy.org.com NO_PROXY=*.org.com,localhost,127.0.0.1 ``` I need the proxy variables set so that the global npm registry is accessible to install opencode's necessary plugins from, BUT I need opencode to connect to a local LiteLLM proxy as the LLM provider, running on (say) `litellm.org.com:4000`. My org requires that internal traffic should not be sent through the proxy, which is why I have `*.org.com` in my NO_PROXY. This setup works for every other application I use (including claude code) Opencode seems to be routing the requests to LiteLLM also through the proxy, the log files include the error message that my org's proxy returns when you try reaching some internal endpoint through it. Removing the HTTP_PROXY/HTTPS_PROXY in turn ends up working, but is just a band-aid fix ### Plugins _No response_ ### OpenCode version 1.1.23 ### Steps to reproduce _No response_ ### Screenshot and/or share link [2026-01-16T063149.log](https://github.com/user-attachments/files/24662870/2026-01-16T063149.log) log including the error from my proxy server Proxy variables set: ```ps PS C:\Users\user> Get-ChildItem Env:*_PROXY Name Value ---- ----- NO_PROXY *.org.com,localhost,127.0.0.1 HTTPS_PROXY http://proxy.org.com:80 ALL_PROXY http://proxy.org.com:80 HTTP_PROXY http://proxy.org.com:80 ``` ### Operating System Windows 11 ### Terminal Windows Terminal, Alacritty
yindo added the windowsbug labels 2026-02-16 18:04:11 -05:00
Author
Owner

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

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

  • #7155: OpenCode Crashes on Launch When http_proxy Environment Variable is Set - similar proxy configuration crash
  • #6953: OpenCode 1.1.2 ignores system proxy environment variables (HTTP_PROXY/HTTPS_PROXY) - proxy environment variables being ignored, marked as CLOSED
  • #531: Support HTTP_PROXY & HTTPS_PROXY - foundational issue requesting proxy support
  • #8787: Why opencode cannot start with my clashX opened - startup fails when proxy is active
  • #4924: Is it possible to use proxy? - general question about proxy support

The key difference in your issue (#8822) is the specific handling of the NO_PROXY environment variable for selective routing, which appears to be not respected even though standard tools handle it correctly.

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

@github-actions[bot] commented on GitHub (Jan 16, 2026): This issue might be a duplicate of existing issues. Please check: - #7155: OpenCode Crashes on Launch When `http_proxy` Environment Variable is Set - similar proxy configuration crash - #6953: OpenCode 1.1.2 ignores system proxy environment variables (HTTP_PROXY/HTTPS_PROXY) - proxy environment variables being ignored, marked as CLOSED - #531: Support HTTP_PROXY & HTTPS_PROXY - foundational issue requesting proxy support - #8787: Why opencode cannot start with my clashX opened - startup fails when proxy is active - #4924: Is it possible to use proxy? - general question about proxy support The key difference in your issue (#8822) is the specific handling of the `NO_PROXY` environment variable for selective routing, which appears to be not respected even though standard tools handle it correctly. Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Jan 26, 2026):

Think this is probably a bun bug, ur using the tui right?

@rekram1-node commented on GitHub (Jan 26, 2026): Think this is probably a bun bug, ur using the tui right?
Author
Owner

@Thesam1798 commented on GitHub (Jan 27, 2026):

Fix available in PR #10856

This issue is addressed by PR #10856 which implements proper NO_PROXY pattern matching.

Your use case:

NO_PROXY=*.org.com,localhost,127.0.0.1

Our implementation supports:

  • Wildcard patterns: *.org.com matches litellm.org.com
  • Suffix patterns: .org.com matches any subdomain
  • Exact match: localhost, 127.0.0.1
  • Domain suffix: org.com also matches sub.org.com

The fix is in packages/opencode/src/util/fetch.ts - we implement our own proxyFetch() wrapper that properly handles NO_PROXY patterns, rather than relying on Bun's native handling.

Note: This is independent of Bun's proxy handling - we explicitly parse and match NO_PROXY patterns before deciding whether to use the proxy.

@Thesam1798 commented on GitHub (Jan 27, 2026): ## Fix available in PR #10856 This issue is addressed by PR #10856 which implements proper `NO_PROXY` pattern matching. **Your use case:** ``` NO_PROXY=*.org.com,localhost,127.0.0.1 ``` **Our implementation supports:** - ✅ Wildcard patterns: `*.org.com` matches `litellm.org.com` - ✅ Suffix patterns: `.org.com` matches any subdomain - ✅ Exact match: `localhost`, `127.0.0.1` - ✅ Domain suffix: `org.com` also matches `sub.org.com` The fix is in `packages/opencode/src/util/fetch.ts` - we implement our own `proxyFetch()` wrapper that properly handles `NO_PROXY` patterns, rather than relying on Bun's native handling. **Note:** This is independent of Bun's proxy handling - we explicitly parse and match `NO_PROXY` patterns before deciding whether to use the proxy.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#6430