laravel/framework · error · InvalidArgumentException

The seconds [$seconds] are not evenly divisible by 60.

Error message

The seconds [$seconds] are not evenly divisible by 60.

What it means

Thrown by ManagesFrequencies::repeatEvery() (src/Illuminate/Console/Scheduling/ManagesFrequencies.php:169) when 60 % $seconds !== 0. Because the scheduler relies on a per-minute cron and sub-minute ticks, the interval must divide 60 evenly (1,2,3,4,5,6,10,12,15,20,30).

Source

Thrown at src/Illuminate/Console/Scheduling/ManagesFrequencies.php:169

        return $this->repeatEvery(30);
    }

    /**
     * Schedule the event to run multiple times per minute.
     *
     * @param  int<1, 59>  $seconds
     * @return $this
     *
     * @throws \InvalidArgumentException
     */
    protected function repeatEvery($seconds)
    {
        if ($seconds <= 0) {
            throw new InvalidArgumentException("The seconds [$seconds] must be greater than zero.");
        }

        if (60 % $seconds !== 0) {
            throw new InvalidArgumentException("The seconds [$seconds] are not evenly divisible by 60.");
        }

        $this->repeatSeconds = $seconds;

        return $this->everyMinute();
    }

    /**
     * Schedule the event to run every minute.
     *
     * @return $this
     */
    public function everyMinute()
    {
        return $this->spliceIntoPosition(1, '*');
    }

    /**

View on GitHub (pinned to bd6b5437e6)

Solutions

  1. Use one of the divisors: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30.
  2. Snap user input to the nearest valid divisor before calling repeatEvery().
  3. Prefer the framework-provided helpers (everySecond/everyFiveSeconds/everyTenSeconds/everyFifteenSeconds/everyTwentySeconds/everyThirtySeconds).
  4. If you genuinely need a non-divisor interval, run a long-running worker instead of cron scheduling.

Example fix

// before
$event->repeatEvery(7);

// after
$valid = [1,2,3,4,5,6,10,12,15,20,30];
$seconds = $valid[count($valid) - 1];
foreach ($valid as $v) { if ($v >= $desired) { $seconds = $v; break; } }
$event->repeatEvery($seconds);
Defensive patterns

Strategy: validation

Validate before calling

$validDivisors = [1,2,3,4,5,6,10,12,15,20,30];
if (! in_array($seconds, $validDivisors, true)) {
    // snap to nearest divisor or reject
}

Type guard

function dividesMinute(int $s): bool
{
    return $s > 0 && $s < 60 && (60 % $s === 0);
}

Try / catch

try {
    $event->repeatEvery($seconds);
} catch (\InvalidArgumentException $e) {
    $event->everyMinute(); // safe default
}

Prevention

When it happens

Trigger: Calling repeatEvery(7), repeatEvery(8), repeatEvery(9), repeatEvery(11), repeatEvery(13)... — any value that does not evenly divide 60. Public helper everyXSeconds() methods only expose valid values; this is mostly hit by direct repeatEvery() / custom helpers.

Common situations: Custom frequency helpers, dynamic intervals from configuration, attempting sub-minute schedules with arbitrary seconds.

Related errors


AI-assisted analysis of laravel/framework@bd6b5437e6 (2026-08-06). Data as JSON: /data/errors/7dee5ec93a62f541.json. Report an issue: GitHub.