{"record":{"id":"6d58d6e32a18ef82","repo":"airbnb/lottie-android","slug":"missing-values-for-keyframe","errorCode":null,"errorMessage":"Missing values for keyframe.","messagePattern":"Missing values for keyframe\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"lottie/src/main/java/com/airbnb/lottie/animation/keyframe/ColorKeyframeAnimation.java","lineNumber":25,"sourceCode":"import java.util.List;\n\npublic class ColorKeyframeAnimation extends KeyframeAnimation<Integer> {\n\n  public ColorKeyframeAnimation(List<Keyframe<Integer>> keyframes) {\n    super(keyframes);\n  }\n\n  @Override\n  Integer getValue(Keyframe<Integer> keyframe, float keyframeProgress) {\n    return getIntValue(keyframe, keyframeProgress);\n  }\n\n  /**\n   * Optimization to avoid autoboxing.\n   */\n  public int getIntValue(Keyframe<Integer> keyframe, float keyframeProgress) {\n    if (keyframe.startValue == null || keyframe.endValue == null) {\n      throw new IllegalStateException(\"Missing values for keyframe.\");\n    }\n\n    // keyframe.endFrame should not be null under normal operation.\n    // It is not clear why this would be null and when it does, it seems to be extremely rare.\n    // https://github.com/airbnb/lottie-android/issues/2361\n    if (valueCallback != null && keyframe.endFrame != null) {\n      //noinspection ConstantConditions\n      Integer value = valueCallback.getValueInternal(keyframe.startFrame, keyframe.endFrame, keyframe.startValue,\n          keyframe.endValue, keyframeProgress, getLinearCurrentKeyframeProgress(), getProgress());\n      if (value != null) {\n        return value;\n      }\n    }\n\n    return GammaEvaluator.evaluate(MiscUtils.clamp(keyframeProgress, 0f, 1f), keyframe.startValue, keyframe.endValue);\n  }\n\n  /**","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/airbnb/lottie-android/blob/05ea92e90381eb8a8ae06855ea2b74f322bebbec/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/ColorKeyframeAnimation.java#L7-L43","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-export the animation and verify the color property has start and end values on every keyframe.","Validate the JSON: each color keyframe object should contain both \"s\" and \"e\" arrays.","Upgrade or align lottie-android with the file's schema version.","If only certain keyframes are affected, simplify the color animation in After Effects."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Validate color keyframes in the JSON before loading\nboolean colorKeyframesOk(JSONObject anim) throws JSONException {\n  JSONArray layers = anim.optJSONArray(\"layers\");\n  // walk shapes -> ks -> k; ensure every keyframe with a \"t\" also has \"s\" and \"e\"\n  return true; // implement traversal per your schema\n}","typeGuard":null,"tryCatchPattern":"lottieAnimationView.setFailureListener(t -> {\n  if (t instanceof IllegalStateException && \"Missing values for keyframe.\".equals(t.getMessage())) {\n    Log.w(TAG, \"malformed color keyframe, hiding animation\", t);\n    lottieAnimationView.setVisibility(View.GONE);\n  } else throw new RuntimeException(t);\n});","preventionTips":["Re-export from After Effects if any color keyframe lacks start/end values.","Add a CI test that loads each asset via LottieCompositionFactory.","Pin a compatible lottie-android version."],"tags":["keyframe","color","parsing","animation"],"backgroundTag":null,"analyzedSha":"05ea92e90381eb8a8ae06855ea2b74f322bebbec","analyzedAt":"2026-08-14T00:51:35.636Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}