phalcon/cphalcon · error · EventNotCancelable

Trying to cancel a non-cancelable event

Error message

Trying to cancel a non-cancelable event

What it means

Thrown by Events Event::stop when the event was created with cancelable=false; stopping propagation is meaningless for it, so the call is rejected. Check isCancelable() before calling stop(), or create the event as cancelable.

Solutions

  1. Check isCancelable() before calling stop(), as the docblock example shows
  2. Construct the event with cancelable=true if propagation must be stoppable
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at phalcon/Events/Event.zep:166 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of phalcon/cphalcon@b7419de9cd (2026-08-21). Data as JSON: /api/errors/73c561108c280c88. Report an issue: GitHub.

Appendix: source

Thrown at phalcon/Events/Event.zep:166

    {
        let this->type = type;

        return this;
    }

    /**
     * Stops the event preventing propagation.
     *
     * ```php
     * if ($event->isCancelable()) {
     *     $event->stop();
     * }
     * ```
     */
    public function stop() -> <EventInterface>
    {
        if unlikely !this->cancelable {
            throw new EventNotCancelable();
        }

        let this->stopped = true;

        return this;
    }
}

View on GitHub (pinned to b7419de9cd)