projectdiscovery/nuclei · error

could not read request: %w

Error message

could not read request: %w

What it means

Error "could not read request: %w" thrown in projectdiscovery/nuclei.

Source

Thrown at pkg/protocols/http/build_request.go:332

	// priority of variables is as follows (from low to high) for self contained templates
	// default signer vars < variables < cli vars < dynamic values < payload < constants

	// evaluate request
	data, err := r.renderText(data, values)
	if err != nil {
		return nil, errkit.Wrap(err, "could not evaluate helper expressions")
	}

	// If the request is a raw request, get the URL from the request
	// header and use it to make the request.
	if isRawRequest {
		// Get the hostname from the URL section to build the request.
		reader := bufio.NewReader(strings.NewReader(data))
	read_line:
		s, err := reader.ReadString('\n')
		if err != nil {
			return nil, fmt.Errorf("could not read request: %w", err)
		}

		// ignore all annotations
		if stringsutil.HasPrefixAny(s, "@") {
			goto read_line
		}

		parts := strings.Split(s, " ")
		if len(parts) < 3 {
			return nil, fmt.Errorf("malformed request supplied")
		}

		if err := expressions.ContainsUnresolvedVariables(parts[1]); err != nil && !r.request.SkipVariablesCheck {
			return nil, errkit.Newf("unresolved variables `%v` found in request", parts[1])
		}

		parsed, err := urlutil.ParseURL(parts[1], true)
		if err != nil {

View on GitHub (pinned to 265b3a3dec)

When it happens

Trigger: Thrown at pkg/protocols/http/build_request.go:332 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of projectdiscovery/nuclei@265b3a3dec (2026-08-15). Data as JSON: /api/errors/8813df6d0b9bc1e9. Report an issue: GitHub.