{"record":{"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/e0f6eb3518ac29fbbca8529e97d0df7fc9f24481/src/Illuminate/Broadcasting/BroadcastManager.php#L301-L337","documentation":"Thrown by BroadcastManager::resolve() when the resolved create{Driver}Driver method (or custom creator) throws any Throwable during broadcaster construction. The original error is wrapped in a RuntimeException preserving the connection name and the underlying message, with the original exception chained as previous. It signals a runtime failure of driver setup, not a misconfiguration of the connection key.","triggerScenarios":"createPusherDriver/createAblyDriver/etc. failing — e.g. missing Pusher/Ably SDK, invalid API keys/cluster, missing Guzzle HTTP client, network/DNS failure to the broadcaster endpoint, or a custom broadcaster constructor raising an exception.","commonSituations":"Pusher/Ably credentials unset or wrong (app_key/secret/cluster); Pusher SDK not installed; app_id empty; cluster mismatch (eu vs mt1); network egress blocked in CI/container; misconfigured Redis host for the redis broadcaster.","solutions":["Inspect getPrevious() to read the underlying SDK/connection error and address it directly.","Set the correct credentials in .env (PUSHER_APP_ID/KEY/SECRET/CLUSTER or REVERB_* or ABLY_KEY).","Install the required SDK: composer require pusher/pusher-php-server (or ably/ably-php).","Verify network egress to the broadcaster host/port from your environment.","For local dev, switch the connection to 'log' or 'null' to isolate the issue."],"exampleFix":"// before — Pusher credentials missing\n// .env: PUSHER_APP_ID= / PUSHER_APP_KEY= / PUSHER_APP_SECRET=\n// error: Failed to create broadcaster for connection \"pusher\" with error: app_key is required.\n\n// after\n// .env\nPUSHER_APP_ID=1234567\nPUSHER_APP_KEY=yourkey\nPUSHER_APP_SECRET=yoursecret\nPUSHER_APP_CLUSTER=mt1\n// composer require pusher/pusher-php-server\n// php artisan config:clear","handlingStrategy":"try-catch","validationCode":"// PHP — pre-flight credentials for the Pusher connection\n$name = config('broadcasting.default');\nif (config(\"broadcasting.connections.{$name}.driver\") === 'pusher') {\n    foreach (['app_id','key','secret'] as $k) {\n        if (empty(config(\"broadcasting.connections.{$name}.{$k}\"))) {\n            throw new \\RuntimeException(\"Pusher {$k} is not set for connection [{$name}].\");\n        }\n    }\n    if (! class_exists(\\Pusher\\Pusher::class)) {\n        throw new \\RuntimeException('pusher/pusher-php-server is not installed.');\n    }\n}\nBroadcast::driver($name);","typeGuard":"// Structural guard for runtime readiness (driver + SDK present)\nfunction broadcasterSdkIsInstalled(string $driver): bool {\n    return match ($driver) {\n        'pusher' => class_exists(\\Pusher\\Pusher::class),\n        'ably'   => class_exists(\\Ably\\AblyRest::class),\n        default  => true,\n    };\n}","tryCatchPattern":"try {\n    Broadcast::driver($name);\n} catch (\\RuntimeException $e) {\n    $prev = $e->getPrevious();\n    Log::error('Broadcaster creation failed', ['connection' => $name, 'cause' => optional($prev)->getMessage() ?? $e->getMessage()]);\n    // fall back to a log/null connection to keep the app alive\n    config(['broadcasting.default' => 'log']);\n}","preventionTips":["Set all required broadcaster credentials in .env.","Install the matching SDK before using a driver.","Catch the wrapped RuntimeException and read getPrevious() for the real cause.","Fall back to 'log'/'null' in dev to isolate credential issues."],"tags":["broadcasting","runtime","laravel","configuration","network"],"backgroundTag":null,"analyzedSha":"e0f6eb3518ac29fbbca8529e97d0df7fc9f24481","analyzedAt":"2026-08-11T20:52:37.562Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}