laravel/framework · error · RuntimeException
Please install the "spatie/fork" Composer package in order t
Error message
Please install the "spatie/fork" Composer package in order to utilize the "fork" driver.
What it means
Thrown by ConcurrencyManager::createForkDriver() when the Fork class (spatie/fork) is not present in the autoloader. The fork driver depends on the optional spatie/fork Composer package, which is not bundled with Laravel. RuntimeException prompts the user to install it.
Source
Thrown at src/Illuminate/Concurrency/ConcurrencyManager.php:52
{
return new ProcessDriver($this->app->make(ProcessFactory::class));
}
/**
* Create an instance of the fork concurrency driver.
*
* @return \Illuminate\Concurrency\ForkDriver
*
* @throws \RuntimeException
*/
public function createForkDriver()
{
if (! $this->app->runningInConsole()) {
throw new RuntimeException('Due to PHP limitations, the fork driver may not be used within web requests.');
}
if (! class_exists(Fork::class)) {
throw new RuntimeException('Please install the "spatie/fork" Composer package in order to utilize the "fork" driver.');
}
return new ForkDriver;
}
/**
* Create an instance of the sync concurrency driver.
*
* @return \Illuminate\Concurrency\SyncDriver
*/
public function createSyncDriver()
{
return new SyncDriver;
}
/**
* Get the default instance name.
*View on GitHub (pinned to bd6b5437e6)
Solutions
- Install the package: composer require spatie/fork.
- Ensure composer install runs in all deploy/CI environments (not --no-dev if it's a dev requirement).
- If fork isn't available, switch the driver to 'process' or 'sync'.
Example fix
// before // fork driver requested but package missing // after (shell) composer require spatie/fork
Defensive patterns
Strategy: fallback
Validate before calling
if (! class_exists(\Spatie\Fork\Fork::class)) {
config(['concurrency.default' => 'process']);
} Type guard
function forkAvailable(): bool { return class_exists(\Spatie\Fork\Fork::class); } Try / catch
try {
$driver = app(\Illuminate\Concurrency\ConcurrencyManager::class)->driver('fork');
} catch (\RuntimeException $e) {
$driver = app(\Illuminate\Concurrency\ConcurrencyManager::class)->driver('process');
} Prevention
- Run composer require spatie/fork once fork is intended; commit composer.lock.
- Ensure composer install (not --no-dev) runs in every deploy/CI env if the package is required as dev.
- Default to 'process' and let only explicitly fork-enabled environments switch to 'fork'.
When it happens
Trigger: Requesting the 'fork' driver without having run composer require spatie/fork. Also after a fresh deploy where composer dependencies were installed with --no-dev and spatie/fork was a dev requirement, or after removing it.
Common situations: New project enabling concurrency with the fork driver for the first time. CI/deploy environments missing optional packages. Team members who didn't run composer require after pulling.
Related errors
- Due to PHP limitations, the fork driver may not be used with
- Concurrent process failed with exit code [$result->exitCode(
- A container implementation is required to use the scheduler.
- To enable support for closure jobs, please install the illum
- Unable to resolve the dispatcher from the service container.
AI-assisted analysis of laravel/framework@bd6b5437e6 (2026-08-06).
Data as JSON: /data/errors/4e8846db723cace4.json.
Report an issue: GitHub.