siyuan-note/siyuan · error

invalid system proxy address

Error message

invalid system proxy address

What it means

normalizeSystemNetworkProxyURL validates one proxy address: it prepends the default scheme when missing, parses it with net/url, and rejects the result if parsing fails or the URL has no host, with "invalid system proxy address". Supported schemes are http, https, socks5, socks5h; other schemes get a separate 'unsupported protocol' error.

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 8641553a1f)

Solutions

  1. Correct the proxy address to host:port form, e.g. proxy.corp.local:8080 or http://proxy.corp.local:8080
  2. Wrap IPv6 hosts in brackets: http://[::1]:8080
  3. Remove stray characters, spaces, or quotes from the configured address and re-enter it
  4. Confirm the host part is actually present before the port (the message means the URL had no parseable host, not a bad port)

Example fix

// before: hostless address
proxies["http"] = "http://:8080"
// after
proxies["http"] = "proxy.corp.local:8080"
Defensive patterns

Strategy: validation

Validate before calling

function isValidProxyAddress(a) { try { const u = new URL(/^\w+:\/\//.test(a) ? a : "http://" + a); return !!u.hostname; } catch { return false; } }

Type guard

function isProxyHostPort(s) { return typeof s === "string" && /^[^\s/:]+(?::\d+)?$/.test(s.trim()); }

Try / catch

try { proxy = loadSystemProxy(); } catch (e) { if (/invalid system proxy address/.test(e.message)) { promptUserToFixProxy(); } else throw e; }

Prevention

When it happens

Trigger: parseSystemNetworkProxy encounters an address that after scheme-defaulting either fails url.Parse or yields an empty Host — e.g. "http://" (no host), "://weird", "http://[bad-ipv6", a value with stray characters/whitespace that breaks parsing, or an empty host portion like "http=?x".

Common situations: Manually mistyped proxy addresses (missing host, extra colon); IPv6 proxies not wrapped in brackets (http://::1:8080); copy-pasted addresses including quotes or trailing garbage; proxy strings containing spaces like "proxy host:8080"; port-only values where the host was accidentally omitted.

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@8641553a1f (2026-09-11). Data as JSON: /api/errors/9903c8a1274e8162. Report an issue: GitHub.