{"record":{"id":"31e2173efa9c6f2a","repo":"infiniflow/ragflow","slug":"invoke-invalid-proxy-url-q-v","errorCode":null,"errorMessage":"Invoke: invalid proxy URL %q: %v","messagePattern":"Invoke: invalid proxy URL %q: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/agent/component/invoke.go","lineNumber":450,"sourceCode":"\t}\n}\n\n// Outputs returns the response surface.\nfunc (i *InvokeComponent) Outputs() map[string]string {\n\treturn map[string]string{\n\t\t\"result\": \"Response body as text.\",\n\t}\n}\n\n// mustParseProxy parses a proxy URL string. We keep this helper here\n// (rather than calling url.Parse inline) so the panic-on-bad-input\n// behavior is uniform across the package — proxy strings are operator-\n// configured, a malformed one is a deployment error worth crashing\n// loud on.\nfunc mustParseProxy(raw string) *url.URL {\n\tu, err := url.Parse(raw)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Invoke: invalid proxy URL %q: %v\", raw, err))\n\t}\n\t// Defensive check: net/http.ProxyURL will silently no-op on a\n\t// URL with no Host. Surface a clear panic instead.\n\tif u.Host == \"\" {\n\t\tpanic(fmt.Sprintf(\"Invoke: proxy URL %q has no host\", raw))\n\t}\n\treturn u\n}\n\n// stripHTMLTags removes HTML tags from the input string. This is a\n// best-effort implementation — it uses a simple regexp to remove\n// everything between < and >. It is NOT a full HTML sanitizer and\n// should only be used for cleaning up response text for consumption\n// by downstream LLM nodes.\n// Mirrors Python's `strip_html_tags` helper (invoke.py).\nfunc stripHTMLTags(s string) string {\n\t// Simple regexp-based approach: remove everything between < and >\n\tre := strings.NewReplacer(","sourceCodeStart":432,"sourceCodeEnd":468,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/internal/agent/component/invoke.go#L432-L468","documentation":"mustParseProxy panics when url.Parse rejects the operator-configured proxy string for the Invoke component. The helper intentionally crashes loudly because a malformed proxy URL is a deployment/configuration error, not a runtime data error: requests would otherwise silently bypass or break the proxy. The panic message embeds the offending raw string and the parse error.","triggerScenarios":"Configuring the Invoke component's proxy parameter with a string url.Parse cannot handle (control characters, invalid percent-escapes such as '%zz', embedded whitespace/newlines); the panic occurs when the proxy URL is parsed during component setup/invocation.","commonSituations":"Typo'd proxy in a canvas/workflow JSON (e.g. 'http//proxy:8080' copied with unescaped characters), secrets templating that leaves a newline in the value, hand-edited YAML/JSON config with stray quotes or whitespace, or environment-injected proxy values containing invalid escape sequences.","solutions":["Correct the proxy URL so it is a valid absolute URL, e.g. http://proxy.example.com:8080 or socks5://host:1080","Remove stray whitespace, newlines, or unescaped percent signs introduced by templating/config files","If the value comes from an env var or secret, print it with %q to spot invisible characters, then fix at the source","Validate proxy strings with url.Parse in a pre-deploy config check before the workflow runs"],"exampleFix":"// before\nproxy: \"http//proxy.corp:8080 %zz\"  // panic: Invoke: invalid proxy URL\n\n// after\nproxy: \"http://proxy.corp:8080\"","handlingStrategy":"validation","validationCode":"if _, err := url.Parse(raw); err != nil {\n    return fmt.Errorf(\"invalid proxy URL %q: %w\", raw, err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["url.Parse every proxy string in a config-validation step before deploying the workflow","Template proxy values from a single well-tested source rather than free-form fields","Log proxy config with %q at startup to expose hidden whitespace/control characters"],"tags":["go","proxy","invoke","configuration","panic","url-parsing"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}