Skip to content
Latchkey

OpenFeature flag evaluation error (TYPE_MISMATCH / FLAG_NOT_FOUND) in CI

OpenFeature evaluated a flag and returned the default with an errorCode. FLAG_NOT_FOUND means the key is not in the provider for the targeted environment; TYPE_MISMATCH means you called getBooleanValue on a flag defined as another type. The provider is ready; the request does not match the flag definition.

What this error means

Evaluations return the default with reason ERROR and errorCode FLAG_NOT_FOUND or TYPE_MISMATCH. The value never reflects the intended flag state.

OpenFeature
{ reason: 'ERROR', errorCode: 'FLAG_NOT_FOUND', value: false }
// or
{ reason: 'ERROR', errorCode: 'TYPE_MISMATCH', value: false }

Common causes

The flag key is missing in the CI environment

FLAG_NOT_FOUND means the provider has no flag by that key in the environment the CI run targets.

The requested type differs from the flag definition

TYPE_MISMATCH means you asked for a boolean (or number/string) but the flag is defined as a different type.

How to fix it

Confirm the key exists and match the type

  1. Verify the flag key exists in the provider for the CI environment.
  2. Call the evaluation method that matches the flag's type.
  3. Pass a sensible default so a genuine miss is visible without crashing.
openfeature.js
// flag defined as string -> use getStringValue, not getBooleanValue
const variant = await client.getStringValue('checkout-variant', 'control');

Inspect details to distinguish miss from mismatch

Use the details form to read errorCode and reason, so you know whether the fix is creating the flag or correcting the type.

openfeature.js
const d = await client.getBooleanDetails('my-flag', false);
console.log(d.reason, d.errorCode);

How to prevent it

  • Reference flag keys from shared constants to avoid typos.
  • Create flags in every environment CI runs against.
  • Match the evaluation method to the flag's declared type.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →