pestphp/pest · error · InvalidArgumentException

The preset name must only contain words from a-z or A-Z.

Error message

The preset name must only contain words from a-z or A-Z.

What it means

Error "The preset name must only contain words from a-z or A-Z." thrown in pestphp/pest.

Source

Thrown at src/Preset.php:69

    }

    public function security(): AbstractPreset
    {
        return $this->executePreset(new Security($this->baseNamespaces()));
    }

    public function relaxed(): AbstractPreset
    {
        return $this->executePreset(new Relaxed($this->baseNamespaces()));
    }

    /**
     * @internal
     */
    public static function custom(string $name, Closure $execute): void
    {
        if (preg_match('/^[a-zA-Z]+$/', $name) === false) {
            throw new InvalidArgumentException('The preset name must only contain words from a-z or A-Z.');
        }

        self::$customPresets[$name] = $execute;
    }

    /**
     * @param  array<int, mixed>  $arguments
     *
     * @throws InvalidArgumentException
     */
    public function __call(string $name, array $arguments): AbstractPreset
    {
        if (! array_key_exists($name, self::$customPresets)) {
            $availablePresets = [
                ...['php', 'laravel', 'strict', 'security', 'relaxed'],
                ...array_keys(self::$customPresets),
            ];

View on GitHub (pinned to 1af74a215c)

When it happens

Trigger: Thrown at src/Preset.php:69 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/8da78a9c42fdf29c. Report an issue: GitHub.