{"record":{"id":"7c7ec7274366898a","repo":"chenhg5/cc-connect","slug":"discord-invalid-proxy-url-q-w","errorCode":null,"errorMessage":"discord: invalid proxy URL %q: %w","messagePattern":"discord: invalid proxy URL %q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/discord/discord.go","lineNumber":122,"sourceCode":"\tprogressStyle := \"compact\"\n\tif v, ok := opts[\"progress_style\"].(string); ok {\n\t\tswitch strings.ToLower(strings.TrimSpace(v)) {\n\t\tcase \"\":\n\t\t\t// keep default\n\t\tcase \"legacy\":\n\t\t\tprogressStyle = \"legacy\"\n\t\tcase \"compact\", \"card\":\n\t\t\tprogressStyle = strings.ToLower(strings.TrimSpace(v))\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"discord: invalid progress_style %q (want legacy, compact, or card)\", v)\n\t\t}\n\t}\n\n\tvar proxyU *url.URL\n\tif proxyStr, _ := opts[\"proxy\"].(string); proxyStr != \"\" {\n\t\tu, err := url.Parse(proxyStr)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"discord: invalid proxy URL %q: %w\", proxyStr, err)\n\t\t}\n\t\tif user, _ := opts[\"proxy_username\"].(string); user != \"\" {\n\t\t\tpass, _ := opts[\"proxy_password\"].(string)\n\t\t\tu.User = url.UserPassword(user, pass)\n\t\t}\n\t\tproxyU = u\n\t}\n\n\tbase := &Platform{\n\t\ttoken:                      token,\n\t\tallowFrom:                  allowFrom,\n\t\tguildID:                    guildID,\n\t\tprogressStyle:              progressStyle,\n\t\tgroupReplyAllGuilds:        groupReplyAllGuilds,\n\t\tshareSessionInChannel:      shareSessionInChannel,\n\t\treadyCh:                    make(chan struct{}),\n\t\tthreadIsolation:            threadIsolation,\n\t\trespondToAtEveryoneAndHere: respondToAtEveryoneAndHere,","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/discord/discord.go#L104-L140","documentation":"The Discord adapter parses the optional \"proxy\" option as a URL at construction time; if url.Parse fails, New wraps and returns the parse error together with the offending string. This catches syntactically invalid proxy URLs before any connection is attempted.","triggerScenarios":"Calling discord.New(opts) where opts[\"proxy\"] is a string that url.Parse rejects — e.g. \"http://[bad-ipv6\", \"::9090\" (ambiguous colon), or control characters in the URL.","commonSituations":"Hand-edited config.toml with a malformed proxy address; missing scheme combined with stray colons; copied proxy URL containing spaces or hidden characters; env-specific proxy injected with wrong format.","solutions":["Fix the proxy URL in the discord platform config so it parses, e.g. \"http://127.0.0.1:7890\" or \"socks5://user:pass@host:1080\".","Percent-encode special characters (spaces, %, non-ASCII) in the URL.","Remove the proxy option if no proxy is needed.","Test the string first with a quick url.Parse in Go or a URI validator to see the exact parse error."],"exampleFix":"// before\nproxy = \"127.0.0.1:7890::socks\"\n\n// after\nproxy = \"socks5://127.0.0.1:7890\"","handlingStrategy":"validation","validationCode":"if v, _ := opts[\"proxy\"].(string); v != \"\" {\n    if _, err := url.Parse(v); err != nil {\n        log.Fatalf(\"invalid discord proxy URL %q: %v\", v, err)\n    }\n}","typeGuard":null,"tryCatchPattern":"p, err := discord.New(opts)\nif err != nil && strings.Contains(err.Error(), \"invalid proxy URL\") {\n    log.Fatalf(\"fix proxy option: %v\", err)\n}","preventionTips":["Always include the scheme in proxy URLs (http:// or socks5://)","Avoid raw spaces and special characters; percent-encode when needed","Verify the proxy string with url.Parse or curl before deploying","Keep proxy settings per-environment in validated config templates"],"tags":["discord","configuration","proxy","url"],"backgroundTag":"invalid-url-format","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}