{"record":{"id":"02d21d587412cf22","repo":"Tencent/WeKnora","slug":"dns-resolution-failed-no-addresses-for-s","errorCode":null,"errorMessage":"DNS resolution failed: no addresses for %s","messagePattern":"DNS resolution failed: no addresses for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/infrastructure/web_fetch/fetcher.go","lineNumber":238,"sourceCode":"\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 {\n\t\t\treturn f.dialContext(ctx, network, pinnedAddress)\n\t\t}\n\t\treturn (&net.Dialer{Timeout: 30 * time.Second, KeepAlive: 30 * time.Second}).DialContext(ctx, network, pinnedAddress)\n\t}\n}\n\nfunc (f *Fetcher) fetchWithBrowser(ctx context.Context, rawURL string) (string, error) {\n\ttarget, err := f.resolvePinnedTarget(ctx, rawURL)\n\tif err != nil {\n\t\treturn \"\", err","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/infrastructure/web_fetch/fetcher.go#L220-L256","documentation":"DNS guard inside Fetcher.pinnedDialContext: after the host passed SSRF/proxy checks, host resolution produced no IP addresses for the hostname. The %s names the host that failed to resolve; it fires during the SSRF-pinning dial so connections to unresolvable hosts are rejected before any TCP attempt.","triggerScenarios":"Thrown at internal/infrastructure/web_fetch/fetcher.go:238 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the host's DNS records (it may genuinely have none, e.g. an empty A/AAAA set)","Verify IPv6/IPv4 availability on the host performing the fetch","Confirm the hostname is correct in the source URL"],"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"}