LaunchDarkly "client timed out waiting for initialization" in CI
The code waited for the LaunchDarkly client to become ready, and the first connection to the streaming or polling endpoint did not complete inside the timeout. The client is returned uninitialized, so variation calls fall back to defaults. In CI this often shows up as a flaky test that passes when the network is fast and fails when it is slow.
What this error means
LaunchDarkly logs "Timeout encountered waiting for LaunchDarkly client initialization" and the client reports not initialized. Tests that depend on real flag values become intermittently red.
[LaunchDarkly] WARN: Timeout encountered waiting for LaunchDarkly client initialization
[LaunchDarkly] WARN: SDK failed to initialize; some data may be missingCommon causes
Egress to LaunchDarkly is blocked or slow
The runner cannot reach stream.launchdarkly.com or clientstream.launchdarkly.com in time because of a proxy, firewall, or a slow network segment.
The start-up wait timeout is too short for CI
A short waitForInitialization timeout that is fine on a warm developer machine expires on a cold CI runner before the first payload arrives.
How to fix it
Raise the initialization wait and handle timeout explicitly
Give the client more time to complete its first fetch, and check the ready flag so the run does not silently proceed on defaults.
const client = LaunchDarkly.init(sdkKey);
try {
await client.waitForInitialization({ timeout: 10 });
} catch (e) {
console.error('LaunchDarkly not ready:', e.message);
}Use a file data source or relay for deterministic CI
For tests, feed flags from a local file (or the Relay Proxy) so no live network call is needed and results are reproducible.
const client = LaunchDarkly.init('sdk-key', {
updateProcessor: LaunchDarkly.FileDataSource({ paths: ['flags.json'] }),
});How to prevent it
- Allow egress to the LaunchDarkly streaming and polling hosts on the runner.
- Set an initialization timeout sized for cold CI runners, not local machines.
- Prefer a file data source or offline mode in tests to remove the network dependency.