airbnb/lottie-android · error · IllegalStateException

Missing values for keyframe.

Error message

Missing values for keyframe.

What it means

Thrown by ColorKeyframeAnimation#getIntValue when a keyframe's startValue or endValue is null. Color keyframes require two concrete color values to interpolate between; a null endpoint means the parsed animation data is incomplete or malformed for that keyframe.

Source

Thrown at lottie/src/main/java/com/airbnb/lottie/animation/keyframe/ColorKeyframeAnimation.java:25

import java.util.List;

public class ColorKeyframeAnimation extends KeyframeAnimation<Integer> {

  public ColorKeyframeAnimation(List<Keyframe<Integer>> keyframes) {
    super(keyframes);
  }

  @Override
  Integer getValue(Keyframe<Integer> keyframe, float keyframeProgress) {
    return getIntValue(keyframe, keyframeProgress);
  }

  /**
   * Optimization to avoid autoboxing.
   */
  public int getIntValue(Keyframe<Integer> keyframe, float keyframeProgress) {
    if (keyframe.startValue == null || keyframe.endValue == null) {
      throw new IllegalStateException("Missing values for keyframe.");
    }

    // keyframe.endFrame should not be null under normal operation.
    // It is not clear why this would be null and when it does, it seems to be extremely rare.
    // https://github.com/airbnb/lottie-android/issues/2361
    if (valueCallback != null && keyframe.endFrame != null) {
      //noinspection ConstantConditions
      Integer value = valueCallback.getValueInternal(keyframe.startFrame, keyframe.endFrame, keyframe.startValue,
          keyframe.endValue, keyframeProgress, getLinearCurrentKeyframeProgress(), getProgress());
      if (value != null) {
        return value;
      }
    }

    return GammaEvaluator.evaluate(MiscUtils.clamp(keyframeProgress, 0f, 1f), keyframe.startValue, keyframe.endValue);
  }

  /**

View on GitHub (pinned to 05ea92e903)

Solutions

  1. Re-export the animation and verify the color property has start and end values on every keyframe.
  2. Validate the JSON: each color keyframe object should contain both "s" and "e" arrays.
  3. Upgrade or align lottie-android with the file's schema version.
  4. If only certain keyframes are affected, simplify the color animation in After Effects.
Defensive patterns

Strategy: try-catch

Validate before calling

// Validate color keyframes in the JSON before loading
boolean colorKeyframesOk(JSONObject anim) throws JSONException {
  JSONArray layers = anim.optJSONArray("layers");
  // walk shapes -> ks -> k; ensure every keyframe with a "t" also has "s" and "e"
  return true; // implement traversal per your schema
}

Try / catch

lottieAnimationView.setFailureListener(t -> {
  if (t instanceof IllegalStateException && "Missing values for keyframe.".equals(t.getMessage())) {
    Log.w(TAG, "malformed color keyframe, hiding animation", t);
    lottieAnimationView.setVisibility(View.GONE);
  } else throw new RuntimeException(t);
});

Prevention

When it happens

Trigger: Internally evaluating a color keyframe whose start or end value failed to parse (missing "s"/"e" color value in the JSON, or a keyframe that is a hold/discrete frame without a proper end color); valueCallback path is only reached when both values exist, so a null value throws before any callback can substitute it.

Common situations: Malformed Lottie JSON with a partially-defined color keyframe; an After Effects export that produced a keyframe without an end color; version incompatibility between the file's color keyframe schema and lottie-android.

Related errors


AI-assisted analysis of airbnb/lottie-android@05ea92e903 (2026-08-14). Data as JSON: /api/errors/6d58d6e32a18ef82. Report an issue: GitHub.