Split.io "Splits are not yet available" / SDK not ready in CI
The Split.io SDK downloads split definitions on start-up and fires SDK_READY when they are available. Calling getTreatment before that returns the "control" treatment and logs that splits are not yet available. In CI the SDK_READY_TIMED_OUT event fires when the first fetch does not finish in time, making treatment-dependent tests flaky.
What this error means
Split.io logs "Splits are not yet available for evaluation, returning control" or emits SDK_READY_TIMED_OUT. getTreatment returns "control" and tests that expect a specific treatment fail intermittently.
[splitio] WARN: Splits are not yet available for evaluation, returning control.
[splitio] ERROR: Split SDK has emitted SDK_READY_TIMED_OUT event.Common causes
Treatments requested before SDK_READY
getTreatment is called before the client emits SDK_READY, so no definitions are loaded and the SDK returns "control".
The readiness timeout is too short for CI
A short readyTimeout expires before the first sync completes on a cold runner, firing SDK_READY_TIMED_OUT.
How to fix it
Wait for SDK_READY before evaluating
Block on the ready event (or ready() promise) so definitions are loaded before any getTreatment call.
await client.ready();
const treatment = client.getTreatment('user-1', 'my_feature');Raise the readiness timeout and use localhost mode in tests
Increase readyTimeout for slow networks, or use Split localhost mode to serve treatments from a file with no network call.
const factory = SplitFactory({
core: { authorizationKey: 'localhost' },
features: { my_feature: 'on' },
});How to prevent it
- Always await SDK_READY before requesting treatments.
- Use Split localhost mode in tests for deterministic treatments.
- Size readyTimeout for cold CI runners, not local machines.