{"record":{"id":"7d0b2dd0e3b9c67c","repo":"Tencent/WeKnora","slug":"invalid-address-s-w","errorCode":null,"errorMessage":"invalid address %s: %w","messagePattern":"invalid address (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/infrastructure/web_fetch/fetcher.go","lineNumber":228,"sourceCode":"\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, classifyHTTPStatus(resp.StatusCode, resp.Status)\n\t}\n\tbody, err := io.ReadAll(io.LimitReader(resp.Body, f.maxBodySize))\n\tif err != nil {\n\t\treturn nil, newFetchError(ErrorRead, true, \"read failed: %v\", err)\n\t}\n\tfinalURL := rawURL\n\tif resp.Request != nil && resp.Request.URL != nil {\n\t\tfinalURL = resp.Request.URL.String()\n\t}\n\treturn &httpFetchResult{body: body, finalURL: finalURL}, nil\n}\n\nfunc (f *Fetcher) pinnedDialContext() func(context.Context, string, string) (net.Conn, error) {\n\treturn func(ctx context.Context, network, address string) (net.Conn, error) {\n\t\thost, port, err := net.SplitHostPort(address)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid address %s: %w\", address, err)\n\t\t}\n\t\tif utils.IsSystemProxy(address) || utils.IsSSRFWhitelisted(host) {\n\t\t\treturn (&net.Dialer{Timeout: 30 * time.Second, KeepAlive: 30 * time.Second}).DialContext(ctx, network, address)\n\t\t}\n\t\tips, err := f.resolveIPs(ctx, host)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"DNS resolution failed for %s: %w\", host, err)\n\t\t}\n\t\tif len(ips) == 0 {\n\t\t\treturn nil, fmt.Errorf(\"DNS resolution failed: no addresses for %s\", host)\n\t\t}\n\t\tfor _, ip := range ips {\n\t\t\tif !utils.IsPublicIP(ip) {\n\t\t\t\treturn nil, fmt.Errorf(\"connection blocked: %s resolves to restricted IP %s\", host, ip)\n\t\t\t}\n\t\t}\n\t\tpinnedAddress := net.JoinHostPort(ips[0].String(), port)\n\t\tif f.dialContext != nil {","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/infrastructure/web_fetch/fetcher.go#L210-L246","documentation":"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.","triggerScenarios":"Thrown at internal/infrastructure/web_fetch/fetcher.go:228 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}