pestphp/pest · error · InvalidOption
The [--update-shards] option cannot be combined with [--shar
Error message
The [--update-shards] option cannot be combined with [--shard].
What it means
Error "The [--update-shards] option cannot be combined with [--shard]." thrown in pestphp/pest.
Source
Thrown at src/Plugins/Shard.php:145
if ($testsToRun === []) {
return $arguments;
}
$filter = $this->buildFilterArgument($testsToRun);
$this->ensureFilterLengthIsSafe($filter);
return [...$arguments, '--filter', $filter];
}
/**
* @param array<int, string> $arguments
* @return array<int, string>
*/
private function handleUpdateShards(array $arguments): array
{
if ($this->hasArgument('--shard', $arguments)) {
throw new InvalidOption('The [--update-shards] option cannot be combined with [--shard].');
}
$arguments = $this->popArgument('--update-shards', $arguments);
self::$updateShards = true;
/** @phpstan-ignore-next-line */
self::$knownTests = $this->allTests($arguments);
if ($this->hasArgument('--parallel', $arguments) || $this->hasArgument('-p', $arguments)) {
Parallel::setGlobal('UPDATE_SHARDS', true);
Parallel::setGlobal('SHARD_RUN_ID', uniqid('pest-shard-', true));
} else {
Event\Facade::instance()->registerSubscriber(new EnsureShardTimingStarted);
Event\Facade::instance()->registerSubscriber(new EnsureShardTimingFinished);
}
return $arguments;View on GitHub (pinned to 1af74a215c)
When it happens
Trigger: Thrown at src/Plugins/Shard.php:145 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/d3dd2cb4c278bb7a.
Report an issue: GitHub.