siyuan-note/siyuan · warning

invalid system proxy address

Error message

invalid system proxy address

What it means

normalizeSystemNetworkProxyURL parses a proxy address (adding a default scheme when missing) and validates that it has a host. An address that fails url.Parse or yields an empty Host is rejected as an invalid system proxy address.

Solutions

  1. Provide a complete proxy address with host and port, e.g. http://127.0.0.1:8080
  2. Trim whitespace and remove stray characters from the proxy setting
  3. Ensure the port is numeric and the URL is well-formed

Example fix

// before
proxyServer = "http://"
// after
proxyServer = "http://127.0.0.1:8080"
Defensive patterns

Strategy: validation

Validate before calling

u, err := url.Parse(strings.TrimSpace(addr)); if err != nil || u.Host == "" { /* fix address before use */ }

Try / catch

if _, err := normalizeSystemNetworkProxyURL(addr, "http"); err != nil { /* prompt user to correct the proxy address */ }

Prevention

When it happens

Trigger: parseSystemNetworkProxy encounters a proxy string like "://host", "http://" (no host), or text that url.Parse cannot handle, producing an empty/invalid host.

Common situations: Malformed ProxyServer registry value; stray whitespace-only entry; copy-paste of a proxy URL missing its host part; locale-mangled characters in the address.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/9903c8a1274e8162. Report an issue: GitHub.

Appendix: source

Thrown at kernel/util/system_proxy.go:103

		}
		if "" == ret.HTTPSProxy {
			ret.HTTPSProxy = socksProxy
		}
	}
	if "" == ret.HTTPProxy && "" == ret.HTTPSProxy {
		return nil, fmt.Errorf("system proxy does not contain a supported HTTP, HTTPS or SOCKS proxy")
	}
	return ret, nil
}

func normalizeSystemNetworkProxyURL(address, defaultScheme string) (string, error) {
	address = strings.TrimSpace(address)
	if !strings.Contains(address, "://") {
		address = defaultScheme + "://" + address
	}
	proxyURL, err := url.Parse(address)
	if err != nil || "" == proxyURL.Host {
		return "", fmt.Errorf("invalid system proxy address")
	}
	switch strings.ToLower(proxyURL.Scheme) {
	case "http", "https", "socks5", "socks5h":
	default:
		return "", fmt.Errorf("unsupported system proxy protocol [%s]", proxyURL.Scheme)
	}
	return proxyURL.String(), nil
}

func parseSystemNetworkProxyBypass(proxyOverride string) string {
	entries := []string{}
	seen := map[string]bool{}
	add := func(entry string) {
		if "" != entry && !seen[entry] {
			entries = append(entries, entry)
			seen[entry] = true
		}
	}

View on GitHub (pinned to 9f775e8a12)