LaunchDarkly "unknown feature flag, returning default value" in CI
The SDK evaluated a flag key that is not present in the environment it loaded, so it logged "unknown feature flag" and returned the default you passed to the variation call. The client is working; the key or the environment is wrong.
What this error means
LaunchDarkly logs "Unknown feature flag \"my-flag\"; returning default value" and every evaluation of that key returns the fallback. Behaviour differs from local because CI points at a different environment.
[LaunchDarkly] WARN: Unknown feature flag "enable-new-checkout"; returning default valueCommon causes
The flag key is misspelled or archived
The variation call uses a key that does not match any flag in the environment (a typo, or a flag that was archived or deleted).
CI targets an environment where the flag was never created
The flag exists in production but not in the test environment whose SDK key the CI job uses, so the SDK sees no such key.
How to fix it
Confirm the exact flag key and environment
- Open the flag in LaunchDarkly and copy its key exactly (keys are case-sensitive).
- Confirm the flag exists in the environment tied to the CI SDK key.
- Update the variation call, or create the flag in the CI environment.
Assert readiness before evaluating
If evaluations run before the client finishes loading, keys can appear unknown transiently. Wait for initialization first, then evaluate.
await client.waitForInitialization({ timeout: 10 });
const on = await client.variation('enable-new-checkout', context, false);How to prevent it
- Reference flag keys from shared constants to avoid typos.
- Create flags in every environment CI runs against, including test.
- Wait for client initialization before the first evaluation.