siyuan-note/siyuan · error
agent HTTP tools support HTTP, HTTPS and SOCKS5 proxies
Error message
agent HTTP tools support HTTP, HTTPS and SOCKS5 proxies
What it means
proxyAddress computes the proxy's host:port, defaulting the port by scheme (http:80, https:443, socks5/socks5h:1080). Any other proxy URL scheme (ftp://, file://, empty/garbage scheme) is rejected because the agent HTTP tools only tunnel through those three proxy types.
Solutions
- Prefix the proxy value with a supported scheme: http://, https://, or socks5://
- Check env with: echo $HTTP_PROXY $HTTPS_PROXY $ALL_PROXY and fix malformed values
- If a custom port is needed, keep the scheme and set the port explicitly (http://proxy:8080)
- Unset irrelevant proxy variables if no proxy is intended
Example fix
// before // HTTP_PROXY=proxy.corp.com:8080 // after // HTTP_PROXY=http://proxy.corp.com:8080
Defensive patterns
Strategy: validation
Validate before calling
u, err := url.Parse(proxyEnv)
if err != nil || (u.Scheme != "http" && u.Scheme != "https" && u.Scheme != "socks5" && u.Scheme != "socks5h") {
return fmt.Errorf("proxy %q must use http/https/socks5 scheme", proxyEnv)
} Type guard
func isSupportedProxyScheme(s string) bool {
switch strings.ToLower(s) {
case "http", "https", "socks5", "socks5h":
return true
}
return false
} Try / catch
if err != nil && strings.Contains(err.Error(), "support HTTP, HTTPS and SOCKS5 proxies") {
return fmt.Errorf("unsupported proxy scheme in proxy URL; use http://, https:// or socks5://")
} Prevention
- Always include an explicit scheme in proxy environment variables
- Lint CI/container env files for malformed HTTP_PROXY/HTTPS_PROXY values
- Only use http/https/socks5(h) proxies with agent tooling
When it happens
Trigger: Setting HTTP_PROXY/HTTPS_PROXY/ALL_PROXY (or the tool's proxy config) to a URL whose scheme is not http/https/socks5/socks5h — e.g. "ALL_PROXY=ftp://proxy:21", "HTTP_PROXY=myproxy:8080" (unparseable as a URL scheme), or an empty-scheme string.
Common situations: Environment variable written without a scheme (common mistake: HTTP_PROXY=proxy.corp.com:8080); leftover unusual scheme from a VPN client; copy-pasting a proxy string from documentation that omitted http://.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- 26
- AI configuration is unavailable
- automatic proxy configuration is not supported
- automatic proxy detection is not supported
- cannot save incomplete notebook crypto configuration
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/0eba288fc1150ade.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/util/httprequest.go:264
resp.Body.Close()
conn.Close()
return nil, nil, fmt.Errorf("proxy CONNECT returned %s", resp.Status)
}
return conn, reader, nil
}
func proxyAddress(proxyURL *url.URL) (string, error) {
port := proxyURL.Port()
if port == "" {
switch strings.ToLower(proxyURL.Scheme) {
case "http":
port = "80"
case "https":
port = "443"
case "socks5", "socks5h":
port = "1080"
default:
return "", errors.New("agent HTTP tools support HTTP, HTTPS and SOCKS5 proxies")
}
}
return net.JoinHostPort(proxyURL.Hostname(), port), nil
}
type connectionReadCloser struct {
io.ReadCloser
conn net.Conn
done chan struct{}
closeOnce sync.Once
closeErr error
}
func newConnectionReadCloser(ctx context.Context, body io.ReadCloser, conn net.Conn) *connectionReadCloser {
ret := &connectionReadCloser{ReadCloser: body, conn: conn, done: make(chan struct{})}
go func() {
select {
case <-ctx.Done():View on GitHub (pinned to 9f775e8a12)