{"record":{"id":"3d422292910ef887","repo":"owasp-amass/amass","slug":"failed-to-provide-a-valid-amass-http-request","errorCode":null,"errorMessage":"failed to provide a valid Amass HTTP request","messagePattern":"failed to provide a valid Amass HTTP request","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/net/http/http.go","lineNumber":173,"sourceCode":"\t}\n\n\treturn &Response{\n\t\tStatus:     resp.Status,\n\t\tStatusCode: resp.StatusCode,\n\t\tProto:      resp.Proto,\n\t\tProtoMajor: resp.ProtoMajor,\n\t\tProtoMinor: resp.ProtoMinor,\n\t\tHeader:     HdrToAmassHeader(resp.Header),\n\t\tBody:       body,\n\t\tLength:     int64(len(body)),\n\t\tTLS:        resp.TLS,\n\t}\n}\n\n// RequestWebPage returns the response headers, body, and status code for the provided URL when successful.\nfunc RequestWebPage(ctx context.Context, client *http.Client, r *Request) (*Response, error) {\n\tif r == nil {\n\t\treturn nil, errors.New(\"failed to provide a valid Amass HTTP request\")\n\t}\n\n\tif r.Method == \"\" {\n\t\tr.Method = http.MethodGet\n\t} else if r.Method != http.MethodGet && r.Method != http.MethodPost && r.Method != http.MethodDelete {\n\t\treturn nil, errors.New(\"failed to provide a valid HTTP method\")\n\t}\n\n\treq, err := http.NewRequestWithContext(ctx, r.Method, r.URL, strings.NewReader(r.Body))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Close = true\n\n\tif r.Auth != nil && r.Auth.Username != \"\" && r.Auth.Password != \"\" {\n\t\treq.SetBasicAuth(r.Auth.Username, r.Auth.Password)\n\t}\n","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/internal/net/http/http.go#L155-L191","documentation":"RequestWebPage was invoked with a nil *Request argument. It is a simple nil-guard at the top of the function: no URL, method, or headers exist to send, so the HTTP request cannot even be attempted. Only observed from TestRequestWebPage in production code paths.","triggerScenarios":"Thrown at internal/net/http/http.go:173 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure callers construct and pass a non-nil Request (typically via a helper like NewRequest) before calling RequestWebPage","Return or skip earlier in the calling code when the request would be nil (e.g. optional scraping disabled)","In tests, build a valid Request object instead of passing nil"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"79299dce87b0085db0f2f4ef3e9c52cccb49f514","analyzedAt":"2026-09-06T08:22:48.198Z","contentChangedAt":"2026-09-06T08:22:48.198Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}