getgrav/grav · error · RuntimeException

MinuteAfter parameter cannot be negative !

Error message

MinuteAfter parameter cannot be negative !

What it means

Error "MinuteAfter parameter cannot be negative !" thrown in getgrav/grav.

Source

Thrown at system/src/Grav/Common/Scheduler/Cron.php:472

            (empty($this->hours) || in_array($hour, $this->hours, true)) &&
            (empty($this->dom) || in_array($day, $this->dom, true)) &&
            (empty($this->months) || in_array($month, $this->months, true)) &&
            (empty($this->dow) || in_array($weekday, $this->dow, true) || ($weekday == 0 && in_array(7, $this->dow, true)) || ($weekday == 7 && in_array(0, $this->dow, true))
            );
    }

    /**
     * @param int|string|DateTime $date
     * @param int $minuteBefore
     * @param int $minuteAfter
     */
    public function matchWithMargin($date, $minuteBefore = 0, $minuteAfter = 0)
    {
        if ($minuteBefore > 0) {
            throw new RuntimeException('MinuteBefore parameter cannot be positive !');
        }
        if ($minuteAfter < 0) {
            throw new RuntimeException('MinuteAfter parameter cannot be negative !');
        }

        $date = $this->parseDate($date, $min, $hour, $day, $month, $weekday);
        $interval = new DateInterval('PT1M'); // 1 min
        if ($minuteBefore !== 0) {
            $date->sub(new DateInterval('PT' . abs($minuteBefore) . 'M'));
        }
        $n = $minuteAfter - $minuteBefore + 1;
        for ($i = 0; $i < $n; $i++) {
            if ($this->matchExact($date)) {
                return true;
            }
            $date->add($interval);
        }

        return false;
    }

View on GitHub (pinned to 6040efed04)

When it happens

Trigger: Thrown at system/src/Grav/Common/Scheduler/Cron.php:472 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of getgrav/grav@6040efed04 (2026-08-17). Data as JSON: /api/errors/61a85dd6ef7e4e3f. Report an issue: GitHub.