Tencent/WeKnora · error
invalid proxy_url: %w
Error message
invalid proxy_url: %w
What it means
Returned by NewSearchHTTPClient when the supplied proxyURL (after trimming) fails Validate — i.e. it is not a well-formed proxy URL with an acceptable scheme. The client refuses to build an outbound search HTTP client with an untrusted proxy, so all providers created with this proxy fail at construction.
Source
Thrown at internal/infrastructure/web_search/proxy.go:40
// NewSearchHTTPClient builds an http.Client for outbound web search requests.
// It uses utils.SSRFSafeDialContext, optional explicit or environment proxy, and
// redirect validation consistent with utils.NewSSRFSafeHTTPClient.
func NewSearchHTTPClient(timeout time.Duration, proxyURL string) (*http.Client, error) {
proxyURL = strings.TrimSpace(proxyURL)
def, ok := http.DefaultTransport.(*http.Transport)
if !ok {
return nil, fmt.Errorf("default HTTP transport is not *http.Transport")
}
t := def.Clone()
t.DialContext = utils.SSRFSafeDialContext
if proxyURL != "" {
if err := ValidateProxyURL(proxyURL); err != nil {
return nil, err
}
u, err := url.Parse(proxyURL)
if err != nil {
return nil, fmt.Errorf("invalid proxy_url: %w", err)
}
if u.Scheme == "" || u.Host == "" {
return nil, fmt.Errorf("invalid proxy_url: scheme and host are required")
}
t.Proxy = http.ProxyURL(u)
} else {
t.Proxy = http.ProxyFromEnvironment
}
cfg := utils.DefaultSSRFSafeHTTPClientConfig()
cfg.Timeout = timeout
return utils.NewSSRFSafeHTTPClientWithTransport(cfg, t), nil
}
View on GitHub (pinned to 988cbb0330)
Solutions
- Correct the proxy_url to a full absolute URL with http/https scheme
- Clear the proxy setting to use direct/environment proxy resolution
Example fix
// before proxyURL := "http://[fe80::1:8080" // malformed IPv6 // after proxyURL := "http://[fe80::1]:8080"
Defensive patterns
Strategy: validation
Validate before calling
func checkProxyURL(raw string) error {
raw = strings.TrimSpace(raw)
if raw == "" {
return nil
}
if _, err := url.Parse(raw); err != nil {
return fmt.Errorf("proxy_url unparseable: %w", err)
}
return nil
} Try / catch
client, err := web_search.NewSearchHTTPClient(timeout, proxyURL)
if err != nil {
if strings.Contains(err.Error(), "invalid proxy_url") {
return fmt.Errorf("config error in proxy_url %q: %w", proxyURL, err)
}
return err
} Prevention
- Run url.Parse on proxy config at startup, fail fast
- Quote and escape special characters in proxy URLs in YAML/env files
- Keep proxy settings in one validated config struct
- Test proxy connectivity separately from provider logic
When it happens
Trigger: NewSearchHTTPClient called with a proxyURL string that url.Parse rejects, e.g. "http://[bad-ipv6", or strings containing invalid percent-escapes like "http://host:port%x".
Common situations: Typos in the proxy config, copy-pasted proxy strings with stray characters or spaces in unusual positions, environment-specific config files with corrupted values.
Related errors
- invalid proxy_url: scheme and host are required
- create request: %w
- failed to create request: %w
- invalid SearXNG base_url: must be an absolute http(s) URL
- invalid SearXNG base_url: must not contain query or fragment
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/ec27b761110ec994.
Report an issue: GitHub.