{"record":{"id":"9903c8a1274e8162","repo":"siyuan-note/siyuan","slug":"invalid-system-proxy-address","errorCode":null,"errorMessage":"invalid system proxy address","messagePattern":"invalid system proxy address","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/util/system_proxy.go","lineNumber":103,"sourceCode":"\t\t}\n\t\tif \"\" == ret.HTTPSProxy {\n\t\t\tret.HTTPSProxy = socksProxy\n\t\t}\n\t}\n\tif \"\" == ret.HTTPProxy && \"\" == ret.HTTPSProxy {\n\t\treturn nil, fmt.Errorf(\"system proxy does not contain a supported HTTP, HTTPS or SOCKS proxy\")\n\t}\n\treturn ret, nil\n}\n\nfunc normalizeSystemNetworkProxyURL(address, defaultScheme string) (string, error) {\n\taddress = strings.TrimSpace(address)\n\tif !strings.Contains(address, \"://\") {\n\t\taddress = defaultScheme + \"://\" + address\n\t}\n\tproxyURL, err := url.Parse(address)\n\tif err != nil || \"\" == proxyURL.Host {\n\t\treturn \"\", fmt.Errorf(\"invalid system proxy address\")\n\t}\n\tswitch strings.ToLower(proxyURL.Scheme) {\n\tcase \"http\", \"https\", \"socks5\", \"socks5h\":\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"unsupported system proxy protocol [%s]\", proxyURL.Scheme)\n\t}\n\treturn proxyURL.String(), nil\n}\n\nfunc parseSystemNetworkProxyBypass(proxyOverride string) string {\n\tentries := []string{}\n\tseen := map[string]bool{}\n\tadd := func(entry string) {\n\t\tif \"\" != entry && !seen[entry] {\n\t\t\tentries = append(entries, entry)\n\t\t\tseen[entry] = true\n\t\t}\n\t}","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/util/system_proxy.go#L85-L121","documentation":"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.","triggerScenarios":"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\".","commonSituations":"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.","solutions":["Correct the proxy address to host:port form, e.g. proxy.corp.local:8080 or http://proxy.corp.local:8080","Wrap IPv6 hosts in brackets: http://[::1]:8080","Remove stray characters, spaces, or quotes from the configured address and re-enter it","Confirm the host part is actually present before the port (the message means the URL had no parseable host, not a bad port)"],"exampleFix":"// before: hostless address\nproxies[\"http\"] = \"http://:8080\"\n// after\nproxies[\"http\"] = \"proxy.corp.local:8080\"","handlingStrategy":"validation","validationCode":"function isValidProxyAddress(a) { try { const u = new URL(/^\\w+:\\/\\//.test(a) ? a : \"http://\" + a); return !!u.hostname; } catch { return false; } }","typeGuard":"function isProxyHostPort(s) { return typeof s === \"string\" && /^[^\\s/:]+(?::\\d+)?$/.test(s.trim()); }","tryCatchPattern":"try { proxy = loadSystemProxy(); } catch (e) { if (/invalid system proxy address/.test(e.message)) { promptUserToFixProxy(); } else throw e; }","preventionTips":["Use host:port form without stray spaces, quotes, or characters","Wrap IPv6 hosts in brackets: [::1]:8080","Ensure the host part exists before the port","Test the address by parsing it as a URL before saving it to system settings"],"tags":["proxy","url","validation","configuration"],"backgroundTag":"invalid-url-format","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}