airbnb/lottie-android · error · IllegalArgumentException
Unknown value for token of type {}
Error message
Unknown value for token of type {} What it means
This method in JsonUtils reads a scalar float value from the JSON stream, handling NUMBER and BEGIN_ARRAY (single-element array) tokens. Any other token type — string, boolean, null, or object — triggers IllegalArgumentException. It is used during Lottie JSON parsing for properties expected to be numeric scalars.
Source
Thrown at lottie/src/main/java/com/airbnb/lottie/parser/JsonUtils.java:118
reader.endObject();
return new PointF(x * scale, y * scale);
}
static float valueFromObject(JsonReader reader) throws IOException {
JsonReader.Token token = reader.peek();
switch (token) {
case NUMBER:
return (float) reader.nextDouble();
case BEGIN_ARRAY:
reader.beginArray();
float val = (float) reader.nextDouble();
while (reader.hasNext()) {
reader.skipValue();
}
reader.endArray();
return val;
default:
throw new IllegalArgumentException("Unknown value for token of type " + token);
}
}
}
View on GitHub (pinned to 05ea92e903)
Solutions
- Validate the Lottie JSON with the LottieFiles validator and a standard JSON parser.
- Locate the offending property using the exception's file/line context, then correct the value to a valid number.
- Re-export or re-download the animation file.
Defensive patterns
Strategy: validation
Try / catch
LottieTask<LottieComposition> task = LottieCompositionFactory.fromAsset(context, name);
task.addListener(result -> { /* success */ })
.addFailureListener(e -> { /* malformed JSON */ }); Prevention
- Validate Lottie JSON with standard JSON parser and LottieFiles validator.
- Use async LottieCompositionFactory APIs to get LottieResult instead of synchronous exceptions.
- Re-export from supported tools if the file is malformed.
When it happens
Trigger: A numeric property in the Lottie JSON (opacity, rotation, scale factor, etc.) contains a non-numeric JSON value such as a string, boolean, or null instead of a number or number array.
Common situations: Malformed Lottie animation where a numeric field was replaced with text or null; animation exported by a tool that uses a non-standard representation for scalar properties; truncated download producing a structural token shift.
Related errors
- Unknown point starts with {}
- Cannot convert json to point. Next token is {}
- Unknown trim path type {}
- Shape data was missing information.
- {} at path {}
AI-assisted analysis of airbnb/lottie-android@05ea92e903 (2026-08-14).
Data as JSON: /api/errors/2ea00d173b11462c.
Report an issue: GitHub.