> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/feature-management-experimentation/use-fme/feature-management/setup/fallback-treatment.md). Agents can also search and read this documentation through its [MCP server](https://developer.harness.io/~gitbook/mcp).

# Fallback treatment

Learn how to configure global and per-flag fallback treatments in Harness FME SDKs to ensure predictable feature flag evaluations when the SDK cannot determine a value.

### Overview <a href="#overview" id="overview"></a>

Fallback treatments are returned by an FME SDK when your application requests a treatment for a feature flag but the SDK cannot determine the value through normal evaluation.

{% hint style="info" %}
This behavior is defined in the SDK itself and is not configured through the Harness FME UI.
{% endhint %}

Fallback treatments are applicable in the following scenarios:

* The SDK cannot connect to Harness services (for example, due to network failure or missing attributes)
* A feature flag or segment evaluation times out
* The flag evaluation cannot be fetched or cached locally
* The evaluation context is incomplete or invalid for targeting
* An unexpected error occurs during evaluation

### How fallback treatments differ from control treatment <a href="#how-fallback-treatments-differ-from-control-treatment" id="how-fallback-treatments-differ-from-control-treatment"></a>

The [control treatment](https://developer.harness.io/feature-management-experimentation/use-fme/feature-management/setup/control-treatment.md) is a reserved treatment in FME that the SDK returns in cases such as missing flag definitions, initialization is not compete, unsupported targeting rules, or unexpected exceptions.

The fallback treatment, on the other hand, is customizable. You choose what the SDK should return if evaluation cannot be completed (for example, `"off"` or `"old-version"`).

Harness recommends providing a fallback treatment when calling the SDK to ensure a predictable user experience if Harness is unavailable, and using low-risk values (like `"off"`) as fallbacks to reduce exposure risk.

### Global vs. flag-level fallback treatments <a href="#global-vs-flag-level-fallback-treatments" id="global-vs-flag-level-fallback-treatments"></a>

Fallback treatments can be defined **globally** for the entire SDK or **per flag** for more granular control:

* **Global fallback**: Returned whenever any flag cannot be evaluated, unless a flag-level fallback is defined.
* **Flag-level fallback**: Overrides the global fallback for that specific flag, taking precedence when both are defined. This allows you to customize behavior for individual flags without affecting the global default.

For example:

```java
// Global fallback treatment

FallbackTreatmentsConfiguration fallbackTreatmentsConfiguration = new FallbackTreatmentsConfiguration(
    new FallbackTreatment("on-fallback", "{\"prop1\":\"val1\"}"),
    null
);

SplitClientConfig config = SplitClientConfig.builder()
    .fallbackTreatments(fallbackTreatmentsConfiguration)
    .build();

SplitFactory factory = SplitFactoryBuilder.build("YOUR_API_KEY", config);
SplitClient client = factory.client();

// Flag-level fallback treatment
// Overrides the global fallback for the specified flag
FallbackTreatmentsConfiguration flagFallbackConfig = new FallbackTreatmentsConfiguration(
    null,
    new HashMap<String, FallbackTreatment>() {{
        put("FEATURE_FLAG_NAME", new FallbackTreatment("off", "{\"prop2\":\"val2\"}"));
    }}
);

SplitClientConfig clientConfigWithFlagFallback = SplitClientConfig.builder()
    .fallbackTreatments(flagFallbackConfig)
    .build();

SplitFactory factoryWithFlagFallback = SplitFactoryBuilder.build("YOUR_API_KEY", clientConfigWithFlagFallback);
SplitClient clientWithFlagFallback = factoryWithFlagFallback.client();
```

### Supported SDKs for fallback treatments <a href="#supported-sdks-for-fallback-treatments" id="supported-sdks-for-fallback-treatments"></a>

Select an SDK to configure fallback treatments for both client and server applications.

| Android | iOS    | Browser | Flutter | JavaScript | React  | React Native | Java    | Python  | Ruby   | .NET    | Node.js  | Go     |
| ------- | ------ | ------- | ------- | ---------- | ------ | ------------ | ------- | ------- | ------ | ------- | -------- | ------ |
| 5.4.1+  | 3.4.0+ | 1.6.0+  | 1.2.0+  | 11.8.0+    | 2.6.0+ | 1.5.0+       | 4.18.0+ | 10.5.1+ | 8.9.0+ | 7.12.0+ | 11.8.0 + | 6.9.0+ |

<table data-view="cards"><thead><tr><th align="center"></th><th align="center"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td align="center"><img src="https://1473625385-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrT2RGHAjtBTaObzchfpb%2Fuploads%2Fgit-blob-c3714f212487f9a07adde714bed0ef07b4a46e4f%2Fimage.png?alt=media" alt="" data-size="original"></td><td align="center"><strong>Android SDK</strong></td><td><a href="https://developer.harness.io/feature-management-experimentation/new-to-fme/sdks-and-customer-deployed-components/client-side-sdks/client-side-standard-sdks/android-sdk.md#configure-fallback-treatments">Android SDK</a></td></tr><tr><td align="center"><img src="https://1473625385-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrT2RGHAjtBTaObzchfpb%2Fuploads%2Fgit-blob-8bd7dfb480bf6ed4f0129f3278a7d7266d323a9a%2Fimage.png?alt=media" alt="" data-size="original"></td><td align="center"><strong>iOS SDK</strong></td><td><a href="https://developer.harness.io/feature-management-experimentation/new-to-fme/sdks-and-customer-deployed-components/client-side-sdks/client-side-standard-sdks/ios-sdk.md#configure-fallback-treatments">iOS SDK</a></td></tr><tr><td align="center"><img src="https://1473625385-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrT2RGHAjtBTaObzchfpb%2Fuploads%2Fgit-blob-34d3e35cd3d7f5a12d822394d47596332a36355a%2Fimage.png?alt=media" alt="" data-size="original"></td><td align="center"><strong>Browser SDK</strong></td><td><a href="https://developer.harness.io/feature-management-experimentation/new-to-fme/sdks-and-customer-deployed-components/client-side-sdks/client-side-standard-sdks/browser-sdk.md#configure-fallback-treatments">Browser SDK</a></td></tr><tr><td align="center"><img src="https://1473625385-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrT2RGHAjtBTaObzchfpb%2Fuploads%2Fgit-blob-52ee20d3fdb13ea24a64c3072e0d223fa821df70%2Fimage.png?alt=media" alt="" data-size="original"></td><td align="center"><strong>Flutter Plugin</strong></td><td><a href="https://developer.harness.io/feature-management-experimentation/new-to-fme/sdks-and-customer-deployed-components/client-side-sdks/client-side-standard-sdks/flutter-plugin.md#configure-fallback-treatments">Flutter plugin</a></td></tr><tr><td align="center"><img src="https://1473625385-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrT2RGHAjtBTaObzchfpb%2Fuploads%2Fgit-blob-ed0c02f95bc2d533c7ae6750a769f486018c0ddf%2Fimage.png?alt=media" alt="" data-size="original"></td><td align="center"><strong>JavaScript SDK</strong></td><td><a href="https://developer.harness.io/feature-management-experimentation/new-to-fme/sdks-and-customer-deployed-components/client-side-sdks/client-side-standard-sdks/javascript-sdk.md#configure-fallback-treatments">JavaScript SDK</a></td></tr><tr><td align="center"><img src="https://1473625385-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrT2RGHAjtBTaObzchfpb%2Fuploads%2Fgit-blob-67b161905f0cd2eeec21cdd6712ca22601dd5e67%2Fimage.png?alt=media" alt="" data-size="original"></td><td align="center"><strong>React SDK</strong></td><td><a href="https://developer.harness.io/feature-management-experimentation/new-to-fme/sdks-and-customer-deployed-components/client-side-sdks/client-side-standard-sdks/react-sdk.md#configure-fallback-treatments">React SDK</a></td></tr><tr><td align="center"><img src="https://1473625385-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrT2RGHAjtBTaObzchfpb%2Fuploads%2Fgit-blob-67b161905f0cd2eeec21cdd6712ca22601dd5e67%2Fimage.png?alt=media" alt="" data-size="original"></td><td align="center"><strong>React Native SDK</strong></td><td><a href="https://developer.harness.io/feature-management-experimentation/new-to-fme/sdks-and-customer-deployed-components/client-side-sdks/client-side-standard-sdks/react-native-sdk.md#configure-fallback-treatments">React Native SDK</a></td></tr><tr><td align="center"><img src="https://1473625385-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrT2RGHAjtBTaObzchfpb%2Fuploads%2Fgit-blob-123bb1fe4b2fa49d54852fa2afdef9b2c450519a%2Fimage.png?alt=media" alt="" data-size="original"></td><td align="center"><strong>Java SDK</strong></td><td><a href="https://developer.harness.io/feature-management-experimentation/new-to-fme/sdks-and-customer-deployed-components/server-side-sdks/java-sdk.md#configure-fallback-treatments">Java SDK</a></td></tr><tr><td align="center"><img src="https://developer.harness.io/provider-logos/python-logo.svg" alt="Python SDK"></td><td align="center"><strong>Python SDK</strong></td><td><a href="https://developer.harness.io/feature-management-experimentation/new-to-fme/sdks-and-customer-deployed-components/server-side-sdks/python-sdk.md#configure-fallback-treatments">Python SDK</a></td></tr><tr><td align="center"><img src="https://developer.harness.io/provider-logos/ruby-logo.svg" alt="Ruby SDK"></td><td align="center"><strong>Ruby SDK</strong></td><td><a href="https://developer.harness.io/feature-management-experimentation/new-to-fme/sdks-and-customer-deployed-components/server-side-sdks/ruby-sdk.md#configure-fallback-treatments">Ruby SDK</a></td></tr><tr><td align="center"><img src="https://1473625385-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrT2RGHAjtBTaObzchfpb%2Fuploads%2Fgit-blob-a73f55478934ce00f07a3971f97888fed1ea601a%2Fimage.png?alt=media" alt="" data-size="original"></td><td align="center"><strong>.NET SDK</strong></td><td><a href="https://developer.harness.io/feature-management-experimentation/new-to-fme/sdks-and-customer-deployed-components/server-side-sdks/net-sdk.md#configure-fallback-treatments">.NET SDK</a></td></tr><tr><td align="center"><img src="https://1473625385-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrT2RGHAjtBTaObzchfpb%2Fuploads%2Fgit-blob-e93bcf56f94bd9891f686ae509ad2c81099b3306%2Fimage.png?alt=media" alt="" data-size="original"></td><td align="center"><strong>Node.js SDK</strong></td><td><a href="https://developer.harness.io/feature-management-experimentation/new-to-fme/sdks-and-customer-deployed-components/server-side-sdks/nodejs-sdk.md#configure-fallback-treatments">Node.js SDK</a></td></tr><tr><td align="center"><img src="https://1473625385-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrT2RGHAjtBTaObzchfpb%2Fuploads%2Fgit-blob-fdf1a084104403268edde7112359ef90eaac7fe7%2Fimage.png?alt=media" alt="" data-size="original"></td><td align="center"><strong>Go SDK</strong></td><td><a href="https://developer.harness.io/feature-management-experimentation/new-to-fme/sdks-and-customer-deployed-components/server-side-sdks/go-sdk.md#configure-fallback-treatments">Go SDK</a></td></tr></tbody></table>

## Troubleshooting

### The SDK returns control instead of my fallback treatment

Fallback treatments require a minimum SDK version. Go to [Supported SDKs for fallback treatments](#supported-sdks-for-fallback-treatments) to confirm that your SDK meets the minimum version, and upgrade it if it does not. Then confirm that the fallback treatment is passed in the SDK configuration, because this behavior is defined in the SDK and not in the Harness FME UI.

### A flag returns the global fallback instead of its own fallback

A flag-level fallback takes precedence over the global fallback only when it is defined for that exact flag name. Confirm that the flag name in the fallback configuration matches the feature flag name.

## Next steps

* Go to [Set the default treatment](https://developer.harness.io/feature-management-experimentation/use-fme/feature-management/setup/default-treatment.md) to choose the treatment served when no rule matches.
* Go to [Control treatment](https://developer.harness.io/feature-management-experimentation/use-fme/feature-management/setup/control-treatment.md) to understand when the control treatment is returned.

{% @harness-feedback/feedback %}
