go network_error ai_generated true

go: github.com/example/[email protected]: reading https://proxy.golang.org/github.com/example/pkg/@v/v0.1.0.mod: dial tcp 216.58.194.113:443: connect: connection refused

ID: go/proxy-connection-refused

Also available as: JSON · Markdown · 中文
80%Fix Rate
87%Confidence
0Evidence
2024-06-15First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
1.19 active
1.20 active
1.21 active

Root Cause

The Go module proxy is unreachable due to network issues, firewall blocks, or proxy downtime.

generic

中文

Go 模块代理无法访问,由于网络问题、防火墙阻止或代理宕机。

Workarounds

  1. 85% success Use a different proxy or direct source.
    Set 'export GOPROXY=direct' to bypass the proxy and fetch directly from VCS.
  2. 70% success Configure a corporate proxy or VPN if behind a firewall.
    Set 'export GOPROXY=http://corporate-proxy:8080' or use 'https_proxy' environment variable.

Dead Ends

Common approaches that don't work:

  1. Retrying with 'go get -u' which uses the same proxy. 90% fail

    The proxy is still unreachable; retrying doesn't change network conditions.

  2. Setting GOFLAGS=-insecure to ignore TLS errors. 80% fail

    The error is connection refused, not TLS; this doesn't help.