{"record":{"id":"f74ddca622341c42","repo":"projectdiscovery/nuclei","slug":"could-not-read-request-w-f74ddc","errorCode":null,"errorMessage":"could not read request: %w","messagePattern":"could not read request: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/protocols/http/raw/raw.go","lineNumber":206,"sourceCode":"}\n\n// reads raw request line by line following convention\nfunc readRawRequest(request string, unsafe bool) (*Request, error) {\n\trawRequest := &Request{\n\t\tHeaders: make(map[string]string),\n\t}\n\n\t// store body if it is unsafe request\n\tif unsafe {\n\t\trawRequest.UnsafeRawBytes = stripLeadingAnnotations(request)\n\t}\n\n\t// parse raw request\n\treader := bufio.NewReader(strings.NewReader(request))\nread_line:\n\ts, err := reader.ReadString('\\n')\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not read request: %w\", err)\n\t}\n\t// ignore all annotations\n\tif stringsutil.HasPrefixAny(s, \"@\") {\n\t\tgoto read_line\n\t}\n\n\tparts := strings.Fields(s)\n\tif len(parts) > 0 {\n\t\trawRequest.Method = parts[0]\n\t\tif len(parts) == 2 && strings.Contains(parts[1], \"HTTP\") {\n\t\t\t// When relative path is missing/ not specified it is considered that\n\t\t\t// request is meant to be untampered at path\n\t\t\t// Ex: GET HTTP/1.1\n\t\t\tparts = []string{parts[0], \"\", parts[1]}\n\t\t}\n\t\tif len(parts) < 3 && !unsafe {\n\t\t\t// missing a field\n\t\t\treturn nil, fmt.Errorf(\"malformed request specified: %v\", s)","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/projectdiscovery/nuclei/blob/265b3a3dec374741614e342f813c10f8b38d2bb7/pkg/protocols/http/raw/raw.go#L188-L224","documentation":"Error \"could not read request: %w\" thrown in projectdiscovery/nuclei.","triggerScenarios":"Thrown at pkg/protocols/http/raw/raw.go:206 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"265b3a3dec374741614e342f813c10f8b38d2bb7","analyzedAt":"2026-08-15T20:05:51.855Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}