{"record":{"id":"74f0479bdec48ace","repo":"larksuite/cli","slug":"invalid-https-proxy-address-w","errorCode":null,"errorMessage":"invalid HTTPS proxy address: %w","messagePattern":"invalid HTTPS proxy address: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/validate/url.go","lineNumber":438,"sourceCode":"}\n\nfunc configureHTTPSProxyTLSDialer(transport, source *http.Transport) {\n\tif transport.DialTLSContext != nil || transport.DialTLS != nil {\n\t\treturn\n\t}\n\n\tproxyTLSConfig := cloneDownloadTLSConfig(source.TLSClientConfig)\n\ttransport.DialTLSContext = func(ctx context.Context, network, addr string) (net.Conn, error) {\n\t\trawConn, err := dialDownloadProxy(ctx, source, network, addr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tconfig := proxyTLSConfig.Clone()\n\t\tserverName, _, splitErr := net.SplitHostPort(addr)\n\t\tif splitErr != nil {\n\t\t\trawConn.Close()\n\t\t\treturn nil, fmt.Errorf(\"invalid HTTPS proxy address: %w\", splitErr)\n\t\t}\n\t\tconfig.ServerName = serverName\n\t\ttlsConn := tls.Client(rawConn, config)\n\t\thandshakeCtx := ctx\n\t\tcancel := func() {}\n\t\tif source.TLSHandshakeTimeout > 0 {\n\t\t\thandshakeCtx, cancel = context.WithTimeout(ctx, source.TLSHandshakeTimeout)\n\t\t}\n\t\tdefer cancel()\n\t\tif err := tlsConn.HandshakeContext(handshakeCtx); err != nil {\n\t\t\trawConn.Close()\n\t\t\treturn nil, err\n\t\t}\n\t\treturn tlsConn, nil\n\t}\n}\n\nfunc dialDownloadProxy(ctx context.Context, source *http.Transport, network, addr string) (net.Conn, error) {","sourceCodeStart":420,"sourceCodeEnd":456,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/internal/validate/url.go#L420-L456","documentation":"When tunneling through an HTTPS proxy, the transport dials the proxy and then performs a TLS handshake with it, deriving the SNI from the proxy address. This error wraps net.SplitHostPort failing on the configured proxy address, meaning the address lacks a host:port form (or is malformed), so the proxy TLS server name cannot be determined.","triggerScenarios":"The HTTPS proxy URL/address in configuration has no port (e.g. \"proxy.example.com\" instead of \"proxy.example.com:443\") or is otherwise not parseable by net.SplitHostPort when the CONNECT tunnel is established.","commonSituations":"HTTPS_PROXY / proxy config set without a port; trailing whitespace or bracket mistakes in IPv6 proxy addresses; config migrated from an HTTP proxy (host only) to an HTTPS proxy that requires host:port.","solutions":["Set the proxy address with an explicit port, e.g. https://proxy.example.com:443","For IPv6 proxies, bracket the host: [::1]:8443","Check HTTPS_PROXY/HTTP_PROXY environment variables and CLI proxy config for a missing :port","Fix the wrapped SplitHostPort cause shown in the error (%w) for the exact malformed address"],"exampleFix":"// before\nproxyURL, _ := url.Parse(\"https://proxy.corp.internal\") // no port\n// after\nproxyURL, _ := url.Parse(\"https://proxy.corp.internal:443\")","handlingStrategy":"validation","validationCode":"// Validate the proxy address before configuring the client\nu, err := url.Parse(proxyCfg)\nif err != nil { return err }\nif _, port, serr := net.SplitHostPort(u.Host); serr != nil || port == \"\" {\n    return fmt.Errorf(\"HTTPS proxy must be host:port, got %q\", proxyCfg)\n}","typeGuard":"func validProxyAddr(u *url.URL) bool {\n    host, port, err := net.SplitHostPort(u.Host)\n    return err == nil && host != \"\" && port != \"\"\n}","tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"invalid HTTPS proxy address\") {\n    return fmt.Errorf(\"fix proxy config to host:port form: %w\", err)\n}","preventionTips":["Always include an explicit port in proxy configuration (https://proxy:443)","Bracket IPv6 proxy hosts: [2001:db8::1]:8443","Validate HTTPS_PROXY env values at config-load time","Trim whitespace when reading proxy settings from config/env"],"tags":["proxy","tls","network","config"],"backgroundTag":"invalid-proxy-address","analyzedSha":"7fd6ef3c07182257ce776cdc5a614e122d5bd4b3","analyzedAt":"2026-09-04T21:17:44.649Z","contentChangedAt":"2026-09-04T21:17:44.649Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}