Tencent/WeKnora · error
invalid address %s: %w
Error message
invalid address %s: %w
What it means
Fired in the fetcher's pinnedDialContext when net.SplitHostPort cannot split the dial address into host and port — the address string given to the dialer is malformed (missing port, wrong format). It is a guard against invalid dial targets during SSRF-safe fetching.
Source
Thrown at internal/infrastructure/web_fetch/fetcher.go:228
if resp.StatusCode != http.StatusOK {
return nil, classifyHTTPStatus(resp.StatusCode, resp.Status)
}
body, err := io.ReadAll(io.LimitReader(resp.Body, f.maxBodySize))
if err != nil {
return nil, newFetchError(ErrorRead, true, "read failed: %v", err)
}
finalURL := rawURL
if resp.Request != nil && resp.Request.URL != nil {
finalURL = resp.Request.URL.String()
}
return &httpFetchResult{body: body, finalURL: finalURL}, nil
}
func (f *Fetcher) pinnedDialContext() func(context.Context, string, string) (net.Conn, error) {
return func(ctx context.Context, network, address string) (net.Conn, error) {
host, port, err := net.SplitHostPort(address)
if err != nil {
return nil, fmt.Errorf("invalid address %s: %w", address, err)
}
if utils.IsSystemProxy(address) || utils.IsSSRFWhitelisted(host) {
return (&net.Dialer{Timeout: 30 * time.Second, KeepAlive: 30 * time.Second}).DialContext(ctx, network, address)
}
ips, err := f.resolveIPs(ctx, host)
if err != nil {
return nil, fmt.Errorf("DNS resolution failed for %s: %w", host, err)
}
if len(ips) == 0 {
return nil, fmt.Errorf("DNS resolution failed: no addresses for %s", host)
}
for _, ip := range ips {
if !utils.IsPublicIP(ip) {
return nil, fmt.Errorf("connection blocked: %s resolves to restricted IP %s", host, ip)
}
}
pinnedAddress := net.JoinHostPort(ips[0].String(), port)
if f.dialContext != nil {View on GitHub (pinned to 988cbb0330)
Solutions
- Log the offending address from the wrapped error
- Ensure URLs fetched include an explicit or default port
- Check for a proxy configuration producing malformed addresses
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/infrastructure/web_fetch/fetcher.go:228 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/7d0b2dd0e3b9c67c.
Report an issue: GitHub.