laravel/framework · error · InvalidArgumentException
Broadcast connection [{$name}] is not defined.
Error message
Broadcast connection [{$name}] is not defined. What it means
Thrown by BroadcastManager::resolve() when getConfig($name) returns null, meaning there is no 'broadcasting.connections.{name}' entry in config/broadcasting.php and $name is not 'null'.
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 bd6b5437e6)
Solutions
- Add the connection under 'connections' in config/broadcasting.php with a valid driver and credentials.
- Set BROADCAST_CONNECTION (or broadcasting.default) to a connection that exists.
- Verify the $connection property on ShouldBroadcast events references an existing connection name.
- Run php artisan config:clear after editing.
Example fix
// before - config/broadcasting.php
'connections' => [
'pusher' => [...],
],
// BROADCAST_CONNECTION=reverb -> throws
// after
'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')],
],
], Defensive patterns
Strategy: validation
Validate before calling
$connection = 'reverb';
if (is_null(config("broadcasting.connections.{$connection}"))) {
throw new RuntimeException("Broadcast connection [{$connection}] is not configured.");
}
Broadcast::connection($connection); Type guard
function broadcastConnectionIsConfigured(string $name): bool
{
return ! is_null(config("broadcasting.connections.{$name}"));
} Try / catch
try {
Broadcast::connection($name);
} catch (\InvalidArgumentException $e) {
// fall back to default/null connection or abort with config error
} Prevention
- Define every connection referenced by events under broadcasting.connections.
- Set broadcasting.default to a connection that exists; verify BROADCAST_CONNECTION env.
- Publish and review package broadcast configs before referencing them.
When it happens
Trigger: Calling Broadcast::connection('reverb') when 'reverb' is absent from broadcasting.connections; an event whose $connection property references an undefined connection; BROADCAST_CONNECTION env pointing to a removed entry.
Common situations: Switching broadcast backends without publishing the config; installing a Reverb/Laravel WebSockets package whose config was not published; typo in the connection name on an event class.
Related errors
- Driver [{$config['driver']}] is not supported.
- Failed to create broadcaster for connection "{$name}" with e
- Callback must be a callable, callback array, or a 'Class@met
- Auth guard [{$name}] is not defined.
- Auth driver [{$config['driver']}] for guard [{$name}] is not
AI-assisted analysis of laravel/framework@bd6b5437e6 (2026-08-06).
Data as JSON: /data/errors/b0f268dcb03c4841.json.
Report an issue: GitHub.