airbnb/lottie-android · error · JsonDataException
Cannot skip unexpected {} at {}
Error message
Cannot skip unexpected {} at {} What it means
JsonUtf8Reader.skipName() is called when the parser encounters a property name it doesn't recognize. If the JsonReader's failOnUnknown flag is true (strict mode), instead of skipping it throws JsonDataException, refusing to silently ignore unknown properties. This is a deliberate strict-validation behavior — the library is configured to fail on any unrecognized key in the Lottie JSON.
Source
Thrown at lottie/src/main/java/com/airbnb/lottie/parser/moshi/JsonUtf8Reader.java:578
// can restore the peek state in case we fail to find a match.
String lastPathName = pathNames[stackSize - 1];
String nextName = nextName();
result = findName(nextName, options);
if (result == -1) {
peeked = PEEKED_BUFFERED_NAME;
peekedString = nextName;
// We can't push the path further, make it seem like nothing happened.
pathNames[stackSize - 1] = lastPathName;
}
return result;
}
@Override public void skipName() throws IOException {
if (failOnUnknown) {
throw new JsonDataException("Cannot skip unexpected " + peek() + " at " + getPath());
}
int p = peeked;
if (p == PEEKED_NONE) {
p = doPeek();
}
if (p == PEEKED_UNQUOTED_NAME) {
skipUnquotedValue();
} else if (p == PEEKED_DOUBLE_QUOTED_NAME) {
skipQuotedValue(DOUBLE_QUOTE_OR_SLASH);
} else if (p == PEEKED_SINGLE_QUOTED_NAME) {
skipQuotedValue(SINGLE_QUOTE_OR_SLASH);
} else if (p != PEEKED_BUFFERED_NAME) {
throw new JsonDataException("Expected a name but was " + peek() + " at path " + getPath());
}
peeked = PEEKED_NONE;
pathNames[stackSize - 1] = "null";
}
View on GitHub (pinned to 05ea92e903)
Solutions
- Upgrade the Lottie library to a version that recognizes the property.
- If you control the animation file, remove the unknown property from the JSON.
- If strict mode was explicitly enabled, disable failOnUnknown on the reader (note: the standard Lottie parser does not enable this by default).
Defensive patterns
Strategy: try-catch
Try / catch
LottieTask<LottieComposition> task = LottieCompositionFactory.fromAsset(context, name);
task.addListener(result -> { /* success */ })
.addFailureListener(e -> {
if (e instanceof JsonDataException && e.getMessage().contains("Cannot skip")) {
// unknown property in strict mode
}
}); Prevention
- Keep the Lottie library updated to support new spec fields.
- If you control the animation JSON, remove custom/unknown properties.
- The standard Lottie parser does not enable failOnUnknown by default, so this only triggers in custom configurations.
When it happens
Trigger: The Lottie JSON contains a property name that this version of the Lottie library does not recognize, AND the JsonReader has been configured with failOnUnknown=true. This could be a newer Lottie spec field, a custom/extension field, or a typo in the JSON.
Common situations: Loading a Lottie animation that uses newer spec fields not supported by the current library version; strict-mode parsing configuration enabled; animation contains custom metadata fields that the parser doesn't expect.
Related errors
- Nesting too deep at {}
- Expected BEGIN_ARRAY but was {} at path {}
- Expected END_ARRAY but was {} at path {}
- Expected BEGIN_OBJECT but was {} at path {}
- Expected END_OBJECT but was {} at path {}
AI-assisted analysis of airbnb/lottie-android@05ea92e903 (2026-08-14).
Data as JSON: /api/errors/bd2d089c4e70c6b1.
Report an issue: GitHub.