pestphp/pest · error · InvalidOption
1
1
Error message
The generated filter for this shard is too long (%d characters). This can cause issues with some environments (limit is %d characters). Please increase the number of shards (e.g., use 1/4 instead of 1/2) to reduce the filter length.
What it means
Error "The generated filter for this shard is too long (%d characters). This can cause issues with some environments (limit is %d characters). Please increase the number of shards (e.g., use 1/4 instead of 1/2) to reduce the filter length." thrown in pestphp/pest.
Source
Thrown at src/Plugins/Shard.php:263
$parts[] = preg_quote($key, '/').'\\\\'.(count($sub) > 1 ? '('.$subRegex.')' : $subRegex);
}
}
return implode('|', $parts);
};
return $buildRegex($tree);
}
/**
* @throws InvalidOption
*/
private function ensureFilterLengthIsSafe(string $filter): void
{
$maxLength = (int) (getenv('PEST_SHARD_MAX_FILTER_LENGTH') ?: self::MAX_FILTER_LENGTH);
if (strlen($filter) > $maxLength) {
throw new InvalidOption(sprintf(
'The generated filter for this shard is too long (%d characters). '.
'This can cause issues with some environments (limit is %d characters). '.
'Please increase the number of shards (e.g., use 1/4 instead of 1/2) to reduce the filter length.',
strlen($filter),
$maxLength
));
}
}
public function addOutput(int $exitCode): int
{
self::$passed = $exitCode === 0;
if (self::$updateShards && self::$passed && ! Parallel::isWorker()) {
self::$collectedTimings = $this->collectTimings();
$count = self::$knownTests !== null
? count(array_intersect_key(self::$collectedTimings, array_flip(self::$knownTests)))View on GitHub (pinned to 1af74a215c)
When it happens
Trigger: Thrown at src/Plugins/Shard.php:263 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/6ce67cf419bf7358.
Report an issue: GitHub.