laravel/framework · error · InvalidArgumentException

Broadcast connection

Error message

Broadcast connection [{$name}] is not defined.

What it means

Thrown by BroadcastManager::resolve() when getConfig($name) returns null — no connection entry exists in config/broadcasting.php under 'connections' for the requested name. Broadcasting connections (pusher, redis, ably, log, null) are resolved by name before a driver method is dispatched.

Solutions

  1. Add the connection to config/broadcasting.php 'connections' with the proper driver and credentials.
  2. Set BROADCAST_CONNECTION (and 'default') to a connection key that exists.
  3. Publish/merge the broadcasting config of the package you use (e.g. php artisan vendor:publish for Reverb).
  4. Run php artisan config:clear to drop a stale cached config.

Example fix

// before
// .env: BROADCAST_CONNECTION=reverb
// config/broadcasting.php 'connections' => ['pusher' => [...], 'log' => [...]]

// after
// config/broadcasting.php
'connections' => [
    'pusher' => [...],
    'reverb' => [
        'driver' => 'reverb',
        'key' => env('REVERB_APP_KEY'),
        'secret' => env('REVERB_APP_SECRET'),
        'app_id' => env('REVERB_APP_ID'),
        'options' => ['host' => env('REVERB_HOST'), 'port' => env('REVERB_PORT'), 'scheme' => env('REVERB_SCHEME')],
    ],
    'log' => [...],
],
Defensive patterns

Strategy: validation

Validate before calling

// PHP — confirm the connection exists before resolving
if (! is_array(config("broadcasting.connections.{$name}"))) {
    abort(500, "Broadcast connection [{$name}] is not configured.");
}
Broadcast::connection($name);

Type guard

function broadcastConnectionIsDefined(string $name): bool {
    return is_array(config("broadcasting.connections.{$name}"));
}

Try / catch

try {
    Broadcast::driver($name);
} catch (\InvalidArgumentException $e) {
    report('Unknown broadcast connection: '.$e->getMessage());
    throw $e;
}

Prevention

When it happens

Trigger: Calling Broadcast::connection($name) / Broadcast::driver($name), or referencing a connection in a broadcaster config, where $name is absent from 'connections'; using the default connection when 'default' points at an undeclared key.

Common situations: Setting BROADCAST_CONNECTION env to a value not present in 'connections' (e.g. 'pusher' while the config uses 'reverb'); renaming a connection; config cache predating the change; package (Reverb/Soketi) config not published.

Related errors


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

Appendix: source

Thrown at src/Illuminate/Broadcasting/BroadcastManager.php:303

    {
        return $this->drivers[$name] ?? $this->resolve($name);
    }

    /**
     * Resolve the given broadcaster.
     *
     * @param  string  $name
     * @return \Illuminate\Contracts\Broadcasting\Broadcaster
     *
     * @throws \InvalidArgumentException
     * @throws \RuntimeException
     */
    protected function resolve($name)
    {
        $config = $this->getConfig($name);

        if (is_null($config)) {
            throw new InvalidArgumentException("Broadcast connection [{$name}] is not defined.");
        }

        if (isset($this->customCreators[$config['driver']])) {
            return $this->callCustomCreator($config);
        }

        $driverMethod = 'create'.ucfirst($config['driver']).'Driver';

        if (! method_exists($this, $driverMethod)) {
            throw new InvalidArgumentException("Driver [{$config['driver']}] is not supported.");
        }

        try {
            return $this->{$driverMethod}($config);
        } catch (Throwable $e) {
            throw new RuntimeException("Failed to create broadcaster for connection \"{$name}\" with error: {$e->getMessage()}.", 0, $e);
        }
    }

View on GitHub (pinned to e0f6eb3518)