pestphp/pest · error · InvalidArgumentException

The number of repetitions must be greater than 0.

Error message

The number of repetitions must be greater than 0.

What it means

Error "The number of repetitions must be greater than 0." thrown in pestphp/pest.

Source

Thrown at src/PendingCalls/TestCall.php:335

    public function onlyOnWindows(): self
    {
        return $this->skipOnMac()->skipOnLinux();
    }

    public function onlyOnMac(): self
    {
        return $this->skipOnWindows()->skipOnLinux();
    }

    public function onlyOnLinux(): self
    {
        return $this->skipOnWindows()->skipOnMac();
    }

    public function repeat(int $times): self
    {
        if ($times < 1) {
            throw new InvalidArgumentException('The number of repetitions must be greater than 0.');
        }

        $this->testCaseMethod->repetitions = $times;

        return $this;
    }

    public function flaky(int $tries = 3): self
    {
        if ($tries < 1) {
            throw new InvalidArgumentException('The number of tries must be greater than 0.');
        }

        $this->testCaseMethod->flakyTries = $tries;

        return $this;
    }

View on GitHub (pinned to 1af74a215c)

When it happens

Trigger: Thrown at src/PendingCalls/TestCall.php:335 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of pestphp/pest@1af74a215c (2026-08-21). Data as JSON: /api/errors/b1f5904796fda6d0. Report an issue: GitHub.