projectdiscovery/nuclei · error

event not recognized

Error message

event not recognized

What it means

The waitevent action requires an `event` arg naming a Chrome DevTools Protocol event. An empty value returns 'event not recognized' immediately; a non-empty but unknown name proceeds to proto.GetType and fails with 'event %q does not exist' or 'is not a page event'. So this specific message means the arg is missing entirely.

Source

Thrown at pkg/protocols/headless/engine/page_actions.go:870

			return errors.Wrap(err, "could not get element text node")
		}

		if act.Name != "" {
			out[act.Name] = text
		}
	}
	return nil
}

// WaitEvent waits for an event to happen on the page.
func (p *Page) WaitEvent(act *Action, out ActionData) (func() error, error) {
	event, err := p.getActionArg(act, "event")
	if err != nil {
		return nil, err
	}

	if event == "" {
		return nil, errors.New("event not recognized")
	}

	var waitEvent proto.Event

	gotType := proto.GetType(event)
	if gotType == nil {
		return nil, errkit.Newf("event %q does not exist", event)
	}

	tmp, ok := reflect.New(gotType).Interface().(proto.Event)
	if !ok {
		return nil, errkit.Newf("event %q is not a page event", event)
	}

	waitEvent = tmp

	// allow user to specify max-duration for wait-event
	maxDuration, err := getTimeParameter(p, act, "max-duration", 5, time.Second)

View on GitHub (pinned to 265b3a3dec)

Solutions

  1. Set the event arg to a full CDP event name with domain, e.g. `event: Page.loadEventFired`
  2. Consult the Chrome DevTools Protocol viewer for valid domain.event identifiers
  3. Validate the template with `nuclei -t tpl.yaml -validate`

Example fix

# before
- action: waitevent

# after
- action: waitevent
  event: Page.loadEventFired
Defensive patterns

Strategy: validation

Validate before calling

// programmatic check
if act.ActionType == engine.ActionWaitEvent {
    if strings.TrimSpace(act.GetArg("event")) == "" {
        return errors.New("waitevent step is missing the event arg")
    }
}

Type guard

func isValidCDPEvent(name string) bool {
    return proto.GetType(name) != nil
}

Prevention

When it happens

Trigger: A step with `action: waitevent` that omits the `event:` arg (or leaves it empty). Distinct from the follow-on errors caused by wrong names like `event: pageload` instead of the CDP form `event: Page.loadEventFired`.

Common situations: Authors guessing event names from web-DOM events (load, click) rather than CDP domain events (Page.loadEventFired, Network.responseReceived); template edits dropping the event line.

Related errors


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