{"record":{"id":"9828af1b6370ec17","repo":"chenhg5/cc-connect","slug":"wecom-invalid-proxy-url-q-w","errorCode":null,"errorMessage":"wecom: invalid proxy URL %q: %w","messagePattern":"wecom: invalid proxy URL %q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/wecom/wecom.go","lineNumber":169,"sourceCode":"\tapiBaseURL = strings.TrimRight(strings.TrimSpace(apiBaseURL), \"/\")\n\tif apiBaseURL == \"\" {\n\t\tapiBaseURL = defaultAPIBaseURL\n\t} else {\n\t\tparsed, err := url.Parse(apiBaseURL)\n\t\tif err != nil || (parsed.Scheme != \"https\" && parsed.Scheme != \"http\") || parsed.Host == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"wecom: invalid api_base_url %q: must be a valid http(s) URL\", apiBaseURL)\n\t\t}\n\t}\n\n\ttransport := &http.Transport{\n\t\tMaxIdleConns:        2,\n\t\tMaxIdleConnsPerHost: 1,\n\t\tIdleConnTimeout:     10 * time.Second,\n\t}\n\tif proxyURL, _ := opts[\"proxy\"].(string); proxyURL != \"\" {\n\t\tu, err := url.Parse(proxyURL)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"wecom: invalid proxy URL %q: %w\", proxyURL, err)\n\t\t}\n\t\tproxyUser, _ := opts[\"proxy_username\"].(string)\n\t\tproxyPass, _ := opts[\"proxy_password\"].(string)\n\t\tif proxyUser != \"\" {\n\t\t\tu.User = url.UserPassword(proxyUser, proxyPass)\n\t\t}\n\t\ttransport.Proxy = http.ProxyURL(u)\n\t\ttransport.DisableKeepAlives = true // prevent CONNECT tunnel accumulation on proxy\n\t\tslog.Info(\"wecom: outbound API requests will use proxy (keep-alive disabled)\", \"proxy\", u.Host, \"auth\", proxyUser != \"\")\n\t}\n\tapiClient := &http.Client{Timeout: 30 * time.Second, Transport: transport}\n\n\tenableMarkdown, _ := opts[\"enable_markdown\"].(bool)\n\tallowFrom, _ := opts[\"allow_from\"].(string)\n\tcore.CheckAllowFrom(\"wecom\", allowFrom)\n\n\treturn &Platform{\n\t\tcorpID:         corpID,","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/wecom/wecom.go#L151-L187","documentation":"The optional proxy option must be a URL that url.Parse can handle. New() parses it to build an http.ProxyURL for the platform's API client (with proxy_username/proxy_password layered on as basic auth). If parsing fails, construction aborts with the underlying url.Parse error wrapped in this message.","triggerScenarios":"Setting opts[\"proxy\"] to a malformed URL such as \"http ://proxy:8080\" (space), \"proxy.corp:3128\" without scheme (often parses but note scheme-less hosts may yield opaque errors or later failures), a control character, or an unparseable percent-encoding.","commonSituations":"Corporate proxy URLs copied with stray spaces or brackets; missing http:// scheme; special characters in proxy passwords that were not URL-encoded when embedded in the URL; config variable interpolation producing garbage.","solutions":["Fix the proxy URL syntax, e.g. \"http://proxy.corp.local:3128\", and re-test with url.Parse","Remove special characters or URL-encode them (use url.UserPassword for credentials instead of inline user:pass)","Verify no stray whitespace from YAML/TOML formatting survives into the value","If no proxy is needed, remove the proxy option entirely"],"exampleFix":"// before\n\"proxy\": \"http ://proxy.corp:3128\" // space -> url.Parse error\n// after\n\"proxy\": \"http://proxy.corp:3128\"","handlingStrategy":"validation","validationCode":"proxy, _ := opts[\"proxy\"].(string)\nif proxy != \"\" {\n\tif _, err := url.Parse(strings.TrimSpace(proxy)); err != nil {\n\t\treturn fmt.Errorf(\"proxy %q is not a valid URL: %v\", proxy, err)\n\t}\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Test the proxy URL with url.Parse or curl before adding to config","Prefer proxy_username/proxy_password options over embedding credentials in the URL","Strip stray whitespace from pasted proxy strings","Ensure the scheme (http://) is present"],"tags":["wecom","config","proxy","url"],"backgroundTag":"invalid-url","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}