pestphp/pest · error · DatasetDoesNotExist

A dataset named [%s] does not exist. You may create one usin

Error message

A dataset named [%s] does not exist. You may create one using `dataset('%s', ['a', 'b']);`.

What it means

Error "A dataset named [%s] does not exist. You may create one using `dataset('%s', ['a', 'b']);`." thrown in pestphp/pest.

Source

Thrown at src/Repositories/DatasetsRepository.php:191

    {
        $matchingDatasets = array_filter(self::$datasets, function (string $key) use ($name, $currentTestFile): bool {
            [$datasetScope, $datasetName] = explode(self::SEPARATOR, $key);

            if ($name !== $datasetName) {
                return false;
            }

            return str_starts_with($currentTestFile, $datasetScope);
        }, ARRAY_FILTER_USE_KEY);

        /** @var string|null $closestScopeDatasetKey */
        $closestScopeDatasetKey = array_reduce(
            array_keys($matchingDatasets),
            fn (string|int|null $keyA, string|int|null $keyB): string|int|null => $keyA !== null && strlen((string) $keyA) > strlen((string) $keyB) ? $keyA : $keyB
        );

        if ($closestScopeDatasetKey === null) {
            throw new DatasetDoesNotExist($name);
        }

        return $matchingDatasets[$closestScopeDatasetKey];
    }

    /**
     * @param  array<array<mixed>>  $combinations
     * @return array<array<array<mixed>>>
     */
    private static function getDatasetsCombinations(array $combinations): array
    {
        $result = [[]];
        foreach ($combinations as $index => $values) {
            $tmp = [];
            foreach ($result as $resultItem) {
                foreach ($values as $value) {
                    $tmp[] = array_merge($resultItem, [$index => $value]);
                }

View on GitHub (pinned to 1af74a215c)

When it happens

Trigger: Thrown at src/Repositories/DatasetsRepository.php:191 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/bb19d3ec2c7727c7. Report an issue: GitHub.