{"record":{"id":"a8a2317c82d86bb4","repo":"GopeedLab/gopeed","slug":"network-request-failed-w","errorCode":null,"errorMessage":"Network request failed: %w","messagePattern":"Network request failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/download/engine/inject/stream/module.go","lineNumber":762,"sourceCode":"\t\tswitch reqMeta.Redirect {\n\t\tcase \"manual\":\n\t\t\treturn http.ErrUseLastResponse\n\t\tcase \"error\":\n\t\t\treturn fmt.Errorf(\"redirect failed\")\n\t\tdefault:\n\t\t\tif len(via) > 20 {\n\t\t\t\treturn fmt.Errorf(\"too many redirects\")\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t})\n\tresp, err := reqBuilder.Send(reqMeta.Method, reqMeta.URL)\n\tif err != nil {\n\t\tvar ne net.Error\n\t\tif errorsAsTimeout(err, &ne) {\n\t\t\treturn nil, fmt.Errorf(\"Network request timed out\")\n\t\t}\n\t\treturn nil, fmt.Errorf(\"Network request failed: %w\", err)\n\t}\n\tid := fmt.Sprintf(\"%d\", time.Now().UnixNano())\n\tmeta := &fetchOpenMeta{\n\t\tID:         id,\n\t\tStatus:     resp.StatusCode,\n\t\tStatusText: resp.Status,\n\t\tURL:        reqMeta.URL,\n\t}\n\tif resp.Response != nil && resp.Response.Request != nil && resp.Response.Request.URL != nil {\n\t\tresponseURL := *resp.Response.Request.URL\n\t\tresponseURL.Fragment = \"\"\n\t\tmeta.URL = responseURL.String()\n\t}\n\tfor key, values := range resp.Header {\n\t\tmeta.Headers = append(meta.Headers, [2]string{key, strings.Join(values, \", \")})\n\t}\n\tbodyCloser := io.NopCloser(strings.NewReader(\"\"))\n\tif resp.Response != nil && resp.Response.Body != nil {","sourceCodeStart":744,"sourceCodeEnd":780,"githubUrl":"https://github.com/GopeedLab/gopeed/blob/7b7327ffb30816273a74b142cccc0bc10c5a4c67/pkg/download/engine/inject/stream/module.go#L744-L780","documentation":"The generic failure branch of the injected fetch: reqBuilder.Send() returned an error that is not a timeout, so it is wrapped with %w to preserve the cause. The text after the colon is the underlying Go net error (DNS failure, connection refused, TLS error, proxy error, or the redirect errors above).","triggerScenarios":"gopeed.fetch() to a host that fails DNS resolution or refuses the connection; TLS certificate verification failure; proxy rejecting the request; the wrapped 'redirect failed'/'too many redirects' errors from the redirect policy.","commonSituations":"Corporate networks requiring a proxy that is not configured; sites with certificates missing from the system trust store; typos in the URL host; firewall blocking the downloader; extensions fetching HTTP-only endpoints that got redirected to HTTPS with a bad cert.","solutions":["Read the wrapped part after 'Network request failed:' to identify the real cause (DNS, TLS, proxy, ...)","Verify connectivity with curl from the same machine and configure the proxy in downloader settings if one is required","Retry with backoff for transient connection resets; switch mirrors for persistently failing hosts"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const resp = await fetch(url);\n} catch (e) {\n  const msg = String(e);\n  if (msg.includes('Network request failed')) {\n    // inspect the wrapped cause after the colon:\n    // DNS -> fix host/mirror; TLS -> trust store; proxy -> settings; refused -> port/service down\n  }\n  throw e;\n}","preventionTips":["Always read the wrapped cause after the colon instead of matching the prefix","Confirm required proxy settings before deploying to locked-down networks","Keep a mirror list and rotate on persistent connection failures"],"tags":["network","fetch","http","dns","tls","extension"],"backgroundTag":null,"analyzedSha":"7b7327ffb30816273a74b142cccc0bc10c5a4c67","analyzedAt":"2026-08-16T02:51:03.250Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}