{"record":{"id":"b23207d963e9ffba","repo":"Tencent/WeKnora","slug":"dns-resolution-failed-for-s-w","errorCode":null,"errorMessage":"DNS resolution failed for %s: %w","messagePattern":"DNS resolution failed for (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/infrastructure/web_fetch/fetcher.go","lineNumber":235,"sourceCode":"\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 {\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) {","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/infrastructure/web_fetch/fetcher.go#L217-L253","documentation":"Fired in pinnedDialContext when f.resolveIPs fails to resolve the target host — DNS lookup returned an error (resolver outage, unknown host, context timeout). The fetch is aborted to enforce IP pinning before connecting.","triggerScenarios":"Thrown at internal/infrastructure/web_fetch/fetcher.go:235 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the hostname exists and DNS is functioning","Check resolver configuration and network access from the server","If the context timed out, increase the fetch timeout","Retry the fetch; DNS failures are often transient"],"exampleFix":null,"handlingStrategy":"retry","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"}