Skip to content
Latchkey

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
[LaunchDarkly] WARN: Unknown feature flag "enable-new-checkout"; returning default value

Common 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

  1. Open the flag in LaunchDarkly and copy its key exactly (keys are case-sensitive).
  2. Confirm the flag exists in the environment tied to the CI SDK key.
  3. 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.

flags.js
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.

Frequently asked questions

What causes "LaunchDarkly "unknown feature flag""?
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).
How do I fix LaunchDarkly "unknown feature flag"?
Confirm the exact flag key and environment

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card