laravel/framework · error · RuntimeException

Please install the "spatie/fork" Composer package in order…

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 spatie/fork package class (Fork) is not autoloadable. The fork driver delegates to Spatie\Fork\Fork, which is an optional dependency; if the package is absent the driver cannot operate and throws RuntimeException directing the user to install it.

Solutions

  1. Install the package: composer require spatie/fork.
  2. Run composer install to restore a missing vendor dependency.
  3. Switch to the 'process' driver if forking is not required/available.

Example fix

// before
// 'fork' driver selected but package missing
// after
composer require spatie/fork
Defensive patterns

Strategy: validation

Validate before calling

if (! class_exists(\Spatie\Fork\Fork::class)) {
    throw new \RuntimeException('Run: composer require spatie/fork');
}

Type guard

function forkAvailable(): bool {
    return class_exists(\Spatie\Fork\Fork::class);
}

Try / catch

try {
    return Concurrency::driver('fork')->run($tasks);
} catch (\RuntimeException $e) {
    return Concurrency::driver('process')->run($tasks);
}

Prevention

When it happens

Trigger: Selecting the 'fork' driver (via config or Concurrency::driver('fork')) without having run composer require spatie/fork; the package was removed or composer install was incomplete.

Common situations: Defaulting concurrency.driver to 'fork' in a fresh checkout; deploying without composer install --no-dev removing the package; CI environment missing the dependency.

Related errors


AI-assisted analysis of laravel/framework@e0f6eb3518 (2026-08-11). Data as JSON: /api/errors/4e8846db723cace4. Report an issue: GitHub.

Appendix: 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 e0f6eb3518)