{"record":{"id":"dc9f45994136a45d","repo":"shadow1ng/fscan","slug":"webscan-request-execute-failed","errorCode":"webscan_request_execute_failed","errorMessage":"webscan_request_execute_failed: %w","messagePattern":"webscan_request_execute_failed: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"webscan/lib/Eval.go","lineNumber":537,"sourceCode":"\t\tif redirect {\n\t\t\tif clientGM := gmRequestClient(true); clientGM != nil {\n\t\t\t\tif oResp2, err2 := clientGM.Do(req); err2 == nil {\n\t\t\t\t\toResp, err = oResp2, nil\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif clientGM := gmRequestClient(false); clientGM != nil {\n\t\t\t\tif oResp2, err2 := clientGM.Do(req); err2 == nil {\n\t\t\t\t\toResp, err = oResp2, nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif err != nil {\n\t\t// HTTP请求失败，计为TCP失败\n\t\tstate.IncrementTCPFailedPacketCount()\n\t\treturn nil, fmt.Errorf(\"%s: %w\", i18n.GetText(\"webscan_request_execute_failed\"), err)\n\t}\n\n\t// HTTP请求成功，计为TCP成功\n\tstate.IncrementTCPSuccessPacketCount()\n\tdefer func() { _ = oResp.Body.Close() }()\n\n\t// 解析响应\n\tresp, err := ParseResponse(oResp)\n\tif err != nil {\n\t\tcommon.LogError(i18n.Tr(\"webscan_response_parse_failed\", err))\n\t}\n\n\treturn resp, err\n}\n\nfunc requestClient(redirect bool) *http.Client {\n\tif redirect {\n\t\tif Client != nil {","sourceCodeStart":519,"sourceCodeEnd":555,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/webscan/lib/Eval.go#L519-L555","documentation":"DoRequest failed to execute the outbound HTTP request during POC evaluation. When the underlying http client (including GMTLS fallback) returns an error, the library records a failed TCP packet in the scan state and wraps the transport error with the i18n message webscan_request_execute_failed. This is the library's umbrella error for any network-level failure while sending a POC request.","triggerScenarios":"DoRequest's client.Do/transport round-trip returns a non-nil error: connection refused, DNS failure, TLS/GMTLS handshake failure, request timeout, or nil global client with no usable fallback client.","commonSituations":"Scanning hosts behind firewalls; target ports closed; misconfigured proxy or timeout settings; GMTLS fallback client unavailable (global client nil and fallback skipped); target resolves but drops packets.","solutions":["Unwrap the error (%w) with errors.Unwrap to see the underlying cause and fix that first (connect refused, timeout, DNS, TLS).","Verify the target host:port is reachable with curl/nc before scanning.","Check proxy and timeout configuration used by the scanner's HTTP clients.","Ensure the global client or GMTLS fallback client is properly initialized; tests show DoRequest falls back when the global client is nil.","Add retry logic for transient network failures, since the scan state already tracks TCP failures."],"exampleFix":"// before\nresp, err := DoRequest(req)\nif err != nil { return err }\n\n// after\nresp, err := DoRequest(req)\nvar netErr net.Error\nif errors.As(err, &netErr) && netErr.Timeout() {\n    resp, err = DoRequest(req) // retry transient timeouts\n}\nif err != nil {\n    return fmt.Errorf(\"request to %s failed: %w\", req.URL, err)\n}","handlingStrategy":"try-catch","validationCode":"conn, err := net.DialTimeout(\"tcp\", host+\":\"+port, 3*time.Second)\nif err != nil { return fmt.Errorf(\"target unreachable: %w\", err) }\nconn.Close()","typeGuard":null,"tryCatchPattern":"if _, err := DoRequest(req); err != nil {\n    var netErr net.Error\n    switch {\n    case errors.As(err, &netErr) && netErr.Timeout():\n        // retry with backoff\n    default:\n        // mark target unreachable, continue scan\n    }\n}","preventionTips":["Pre-check target reachability with net.DialTimeout before scanning.","Configure sane client timeouts and proxy settings.","Retry transient failures; the scan state already tracks TCP failures for you."],"tags":["network","http-client","webscan","wrapped-error"],"backgroundTag":"http-request-failed","analyzedSha":"95cc12e753bf43de7004e5aef42a9ffba3934303","analyzedAt":"2026-09-06T17:07:30.094Z","contentChangedAt":"2026-09-06T17:07:30.094Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}