Skip to content
Latchkey

GrowthBook "Failed to fetch features" in CI

The GrowthBook SDK called loadFeatures and could not retrieve the feature definitions from the API host (GrowthBook Cloud or a self-hosted instance). Either the client key or apiHost is wrong, or the host is unreachable. Until features load, every isOn / getFeatureValue returns the fallback.

What this error means

GrowthBook logs "Failed to fetch features" or loadFeatures rejects, and feature checks all return their default because the feature map is empty.

GrowthBook
[GrowthBook] Failed to fetch features:
GET https://cdn.growthbook.io/api/features/<clientKey> 404 (Not Found)

Diagnose it: did the report reach the service?

Coverage and quality integrations fail in two distinct places: the report was never produced, or it was produced and the upload was rejected. Establish which before touching tokens.

Terminal
# 1. does the report exist and is it non-empty?
ls -la coverage/ && head -5 coverage/lcov.info

# 2. does it reference paths the service can map to the repo?
grep "^SF:" coverage/lcov.info | head -5

# 3. did the upload actually succeed, or just not fail the step?
# most uploaders exit 0 on a rejected upload unless told otherwise

Common causes

The client key or apiHost is wrong

A mistyped client key, or an apiHost that does not match your GrowthBook deployment, returns 404 or the wrong payload.

The API host is unreachable from the runner

Egress to the GrowthBook CDN or self-hosted API is blocked, so loadFeatures cannot complete.

How to fix it

Set the correct apiHost and client key, and await loadFeatures

  1. Copy the API host and SDK client key from GrowthBook, SDK Connections.
  2. Pass them into the client and await loadFeatures before evaluating.
  3. For self-hosted, point apiHost at your instance, not the cloud CDN.
growthbook.js
const gb = new GrowthBook({
  apiHost: 'https://cdn.growthbook.io',
  clientKey: process.env.GROWTHBOOK_CLIENT_KEY,
});
await gb.loadFeatures();

Provide features directly for offline tests

Pass a features payload so evaluation is deterministic and needs no network fetch.

growthbook.test.js
const gb = new GrowthBook({
  features: require('./growthbook-features.json'),
});

How to prevent it

  • Keep the GrowthBook client key in CI secrets and set the right apiHost.
  • Await loadFeatures before any feature evaluation.
  • Pass features directly in tests to remove the network dependency.

Frequently asked questions

What causes GrowthBook "Failed to fetch features" in CI?
There are 2 common causes: the client key or apihost is wrong and the api host is unreachable from the runner. A mistyped client key, or an apiHost that does not match your GrowthBook deployment, returns 404 or the wrong payload.
How do I fix GrowthBook "Failed to fetch features" in CI?
There are 2 fixes depending on which cause you have: set the correct apihost and client key, and await loadfeatures and provide features directly for offline tests. Work through them in order, since the first is the most common.
What does GrowthBook "Failed to fetch features" in CI actually mean?
GrowthBook logs "Failed to fetch features" or loadFeatures rejects, and feature checks all return their default because the feature map is empty.
How do I stop GrowthBook "Failed to fetch features" in CI happening again?
Keep the GrowthBook client key in CI secrets and set the right apiHost. The prevention section lists 3 changes that keep it from recurring.

Related guides

References

Not every red build is your code. Latchkey repairs the ones that are not, on the runner. Start free → 30-day trial · No credit card