{"id":"ae5f96f3b09630dc","repo":"laravel/framework","slug":"failed-to-create-broadcaster-for-connection-nam","errorCode":null,"errorMessage":"Failed to create broadcaster for connection \"{$name}\" with error: {$e->getMessage()}.","messagePattern":"Failed to create broadcaster for connection \"(.+?)\" with error: (.+?)\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Broadcasting/BroadcastManager.php","lineNumber":319,"sourceCode":"\n        if (is_null($config)) {\n            throw new InvalidArgumentException(\"Broadcast connection [{$name}] is not defined.\");\n        }\n\n        if (isset($this->customCreators[$config['driver']])) {\n            return $this->callCustomCreator($config);\n        }\n\n        $driverMethod = 'create'.ucfirst($config['driver']).'Driver';\n\n        if (! method_exists($this, $driverMethod)) {\n            throw new InvalidArgumentException(\"Driver [{$config['driver']}] is not supported.\");\n        }\n\n        try {\n            return $this->{$driverMethod}($config);\n        } catch (Throwable $e) {\n            throw new RuntimeException(\"Failed to create broadcaster for connection \\\"{$name}\\\" with error: {$e->getMessage()}.\", 0, $e);\n        }\n    }\n\n    /**\n     * Call a custom driver creator.\n     *\n     * @param  array  $config\n     * @return mixed\n     */\n    protected function callCustomCreator(array $config)\n    {\n        return $this->customCreators[$config['driver']]($this->app, $config);\n    }\n\n    /**\n     * Create an instance of the driver.\n     *\n     * @param  array  $config","sourceCodeStart":301,"sourceCodeEnd":337,"githubUrl":"https://github.com/laravel/framework/blob/bd6b5437e6ad87bb49f9b426724f07a9f64e9683/src/Illuminate/Broadcasting/BroadcastManager.php#L301-L337","documentation":"Thrown by BroadcastManager::resolve() when the chosen create{Driver}Driver() method throws (any Throwable). The manager catches the underlying error and rewraps it into a RuntimeException that names the connection and embeds the original message, preserving the cause as the previous exception.","triggerScenarios":"Missing required credentials for pusher/ably (key/secret/app_id undefined), invalid redis connection config, the Pusher/Ably SDK constructor failing, or Guzzle TLS errors when building the client.","commonSituations":"Empty PUSHER_APP_KEY/PUSHER_APP_SECRET/PUSHER_APP_ID env vars; ABLY_KEY unset; redis connection referenced in config missing from database.redis; network/TLS errors reaching the broadcaster host.","solutions":["Inspect the embedded message (and getCause()/getPrevious()) to find the real failure, then fix credentials/config accordingly.","Fill in all required env vars for the driver (PUSHER_APP_KEY/SECRET/APP_ID, ABLY_KEY, redis connection).","Verify the redis connection name exists under database.redis and is reachable.","Catch RuntimeException around Broadcast::driver() if you want graceful degradation when broadcasting is unavailable."],"exampleFix":"// before - .env\nPUSHER_APP_KEY=\nPUSHER_APP_SECRET=\nPUSHER_APP_ID=\n// Broadcast::driver('pusher') throws \"Failed to create broadcaster...\"\n\n// after\nPUSHER_APP_KEY=abc123\nPUSHER_APP_SECRET=secret\nPUSHER_APP_ID=12345\nPUSHER_HOST=127.0.0.1\nPUSHER_PORT=8080","handlingStrategy":"try-catch","validationCode":"$required = match (config('broadcasting.connections.pusher.driver')) {\n    'pusher', 'reverb' => ['key', 'secret', 'app_id'],\n    'ably' => ['key'],\n    default => [],\n};\nforeach ($required as $k) {\n    if (empty(config(\"broadcasting.connections.pusher.{$k}\"))) {\n        throw new RuntimeException(\"Missing broadcast config key: pusher.{$k}\");\n    }\n}","typeGuard":"function hasRequiredBroadcastCredentials(string $name): bool\n{\n    $c = config(\"broadcasting.connections.{$name}\");\n    return match ($c['driver'] ?? null) {\n        'pusher', 'reverb' => ! empty($c['key']) && ! empty($c['secret']) && ! empty($c['app_id']),\n        'ably' => ! empty($c['key']),\n        default => true,\n    };\n}","tryCatchPattern":"try {\n    Broadcast::driver($name);\n} catch (\\RuntimeException $e) {\n    if (str_contains($e->getMessage(), 'Failed to create broadcaster')) {\n        report($e->getPrevious());\n        // fall back to log/null broadcaster so app keeps working\n        Broadcast::setDefaultDriver('log');\n    } else {\n        throw $e;\n    }\n}","preventionTips":["Fill all required credentials (PUSHER_APP_KEY/SECRET/APP_ID, ABLY_KEY) in .env.","Inspect getPrevious() on the wrapped exception to find the real cause.","Validate broadcast config at deploy time with a health-check command."],"tags":["broadcasting","configuration","pusher","ably","redis","laravel"],"analyzedSha":"bd6b5437e6ad87bb49f9b426724f07a9f64e9683","analyzedAt":"2026-08-06T00:28:32.783Z","schemaVersion":2}