General SDK Error, getTreatment: you passed “SPLIT NAME” that does not exist in this environment

May 14, 2019 16:10

Updated

Problem

When using Split SDK and calling getTreatment for a list of Split names, there are lot of errors raised as below

admin 10 May 2019, 18:10:12 2019-05-10T17:10:12,445 ERROR [admin] [f0f338a964a0e3e1/07cfe07d08568096] [SplitClientImpl:256] - getTreatment: you passed "SPLIT NAME" that does not exist in this environment, please double check what Splits exist in the web console.

Root Cause

This error is part of the validation mechanism in the SDK, if getTreatment call is passing a Split name that does not exist in the Environment (for which the API Key is used), this error will be thrown, since its impossible to calculate the treatment at this point.

Solution

Either make sure the Split names passed are part of the environment, or use the SDK Manager object to loop through the Split names that are added to the environment, this way we can avoid passing an incorrect Split name, as in the Java example below: