airbnb/lottie-android · error · IllegalArgumentException
Unknown trim path type {}
Error message
Unknown trim path type {} What it means
ShapeTrimPath.Type.forId(int) maps integer IDs from the Lottie JSON to the trim-path mode enum. Only ID 1 (SIMULTANEOUSLY) and ID 2 (INDIVIDUALLY) are recognized. Any other integer triggers IllegalArgumentException. This occurs during JSON parsing when the 'm' (trim mode) field of a trim-path shape layer contains an unrecognized value.
Source
Thrown at lottie/src/main/java/com/airbnb/lottie/model/content/ShapeTrimPath.java:23
import com.airbnb.lottie.animation.content.Content;
import com.airbnb.lottie.animation.content.TrimPathContent;
import com.airbnb.lottie.model.animatable.AnimatableFloatValue;
import com.airbnb.lottie.model.layer.BaseLayer;
public class ShapeTrimPath implements ContentModel {
public enum Type {
SIMULTANEOUSLY,
INDIVIDUALLY;
public static Type forId(int id) {
switch (id) {
case 1:
return SIMULTANEOUSLY;
case 2:
return INDIVIDUALLY;
default:
throw new IllegalArgumentException("Unknown trim path type " + id);
}
}
}
private final String name;
private final Type type;
private final AnimatableFloatValue start;
private final AnimatableFloatValue end;
private final AnimatableFloatValue offset;
private final boolean hidden;
public ShapeTrimPath(String name, Type type, AnimatableFloatValue start,
AnimatableFloatValue end, AnimatableFloatValue offset, boolean hidden) {
this.name = name;
this.type = type;
this.start = start;
this.end = end;
this.offset = offset;View on GitHub (pinned to 05ea92e903)
Solutions
- Inspect the Lottie JSON and locate the trim path objects ('ty': 'tm'); verify their 'm' field is 1 or 2. Correct invalid values.
- Upgrade the Lottie library to a version that supports the trim mode used by your animation file.
- If the mode is genuinely new, re-export from After Effects using only standard trim path settings, or remove the trim path modifier from the animation.
Example fix
// before — in the Lottie JSON
{"ty":"tm","m":3,"s":{"a":0,"k":0},"e":{"a":0,"k":100}}
// after — use a valid mode (1 = simultaneously, 2 = individually)
{"ty":"tm","m":1,"s":{"a":0,"k":0},"e":{"a":0,"k":100}} Defensive patterns
Strategy: validation
Try / catch
// Wrap LottieComposition.fromJsonSync / fromInputStream
try {
LottieResult<LottieComposition> result = LottieCompositionFactory.fromAsset(context, "anim.json");
if (result.getValue() == null) {
Throwable t = result.getException();
// log and show fallback
}
} catch (IllegalArgumentException e) {
// unknown enum value in animation JSON
} Prevention
- Validate Lottie JSON with LottieFiles validator before bundling.
- Keep the Lottie library version current to support the latest spec enum values.
- Re-export animations from After Effects using only standard trim path modes.
When it happens
Trigger: The Lottie JSON contains a shape trim path ('ty': 'tm') whose mode field ('m') is set to a value other than 1 or 2. This happens with animations exported from non-standard tools, hand-edited JSON, or future Lottie spec versions that introduce new trim modes not yet supported by this library version.
Common situations: Using a Lottie animation exported from a newer version of Bodymovin/After Effects that added a new trim path mode; manually editing the JSON and mistyping the mode value; loading an animation that targets a newer Lottie spec than the library version supports.
Related errors
- Unknown point starts with {}
- Unknown value for token of type {}
- Cannot convert json to point. Next token is {}
- Shape data was missing information.
- Cannot interpolate between gradients. Lengths vary ({} vs {}
AI-assisted analysis of airbnb/lottie-android@05ea92e903 (2026-08-14).
Data as JSON: /api/errors/e0e0e3930f9d0872.
Report an issue: GitHub.