{"id":"7dee5ec93a62f541","repo":"laravel/framework","slug":"the-seconds-seconds-are-not-evenly-divisible-by","errorCode":null,"errorMessage":"The seconds [$seconds] are not evenly divisible by 60.","messagePattern":"The seconds \\[\\$seconds\\] are not evenly divisible by 60\\.","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Console/Scheduling/ManagesFrequencies.php","lineNumber":169,"sourceCode":"        return $this->repeatEvery(30);\n    }\n\n    /**\n     * Schedule the event to run multiple times per minute.\n     *\n     * @param  int<1, 59>  $seconds\n     * @return $this\n     *\n     * @throws \\InvalidArgumentException\n     */\n    protected function repeatEvery($seconds)\n    {\n        if ($seconds <= 0) {\n            throw new InvalidArgumentException(\"The seconds [$seconds] must be greater than zero.\");\n        }\n\n        if (60 % $seconds !== 0) {\n            throw new InvalidArgumentException(\"The seconds [$seconds] are not evenly divisible by 60.\");\n        }\n\n        $this->repeatSeconds = $seconds;\n\n        return $this->everyMinute();\n    }\n\n    /**\n     * Schedule the event to run every minute.\n     *\n     * @return $this\n     */\n    public function everyMinute()\n    {\n        return $this->spliceIntoPosition(1, '*');\n    }\n\n    /**","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/laravel/framework/blob/bd6b5437e6ad87bb49f9b426724f07a9f64e9683/src/Illuminate/Console/Scheduling/ManagesFrequencies.php#L151-L187","documentation":"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).","triggerScenarios":"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.","commonSituations":"Custom frequency helpers, dynamic intervals from configuration, attempting sub-minute schedules with arbitrary seconds.","solutions":["Use one of the divisors: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30.","Snap user input to the nearest valid divisor before calling repeatEvery().","Prefer the framework-provided helpers (everySecond/everyFiveSeconds/everyTenSeconds/everyFifteenSeconds/everyTwentySeconds/everyThirtySeconds).","If you genuinely need a non-divisor interval, run a long-running worker instead of cron scheduling."],"exampleFix":"// before\n$event->repeatEvery(7);\n\n// after\n$valid = [1,2,3,4,5,6,10,12,15,20,30];\n$seconds = $valid[count($valid) - 1];\nforeach ($valid as $v) { if ($v >= $desired) { $seconds = $v; break; } }\n$event->repeatEvery($seconds);","handlingStrategy":"validation","validationCode":"$validDivisors = [1,2,3,4,5,6,10,12,15,20,30];\nif (! in_array($seconds, $validDivisors, true)) {\n    // snap to nearest divisor or reject\n}","typeGuard":"function dividesMinute(int $s): bool\n{\n    return $s > 0 && $s < 60 && (60 % $s === 0);\n}","tryCatchPattern":"try {\n    $event->repeatEvery($seconds);\n} catch (\\InvalidArgumentException $e) {\n    $event->everyMinute(); // safe default\n}","preventionTips":["Use only the documented divisors for sub-minute schedules.","Snap dynamic intervals to the nearest valid divisor.","Consider a daemon/worker for non-divisor intervals."],"tags":["scheduling","console","validation","laravel"],"analyzedSha":"bd6b5437e6ad87bb49f9b426724f07a9f64e9683","analyzedAt":"2026-08-06T00:28:32.783Z","schemaVersion":2}