{"record":{"id":"2ea00d173b11462c","repo":"airbnb/lottie-android","slug":"unknown-value-for-token-of-type","errorCode":null,"errorMessage":"Unknown value for token of type {}","messagePattern":"Unknown value for token of type (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"lottie/src/main/java/com/airbnb/lottie/parser/JsonUtils.java","lineNumber":118,"sourceCode":"    reader.endObject();\n    return new PointF(x * scale, y * scale);\n  }\n\n  static float valueFromObject(JsonReader reader) throws IOException {\n    JsonReader.Token token = reader.peek();\n    switch (token) {\n      case NUMBER:\n        return (float) reader.nextDouble();\n      case BEGIN_ARRAY:\n        reader.beginArray();\n        float val = (float) reader.nextDouble();\n        while (reader.hasNext()) {\n          reader.skipValue();\n        }\n        reader.endArray();\n        return val;\n      default:\n        throw new IllegalArgumentException(\"Unknown value for token of type \" + token);\n    }\n  }\n}\n","sourceCodeStart":100,"sourceCodeEnd":122,"githubUrl":"https://github.com/airbnb/lottie-android/blob/05ea92e90381eb8a8ae06855ea2b74f322bebbec/lottie/src/main/java/com/airbnb/lottie/parser/JsonUtils.java#L100-L122","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"LottieTask<LottieComposition> task = LottieCompositionFactory.fromAsset(context, name);\ntask.addListener(result -> { /* success */ })\n     .addFailureListener(e -> { /* malformed JSON */ });","preventionTips":["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."],"tags":["lottie","json-parsing","float","malformed-json","illegal-argument"],"backgroundTag":null,"analyzedSha":"05ea92e90381eb8a8ae06855ea2b74f322bebbec","analyzedAt":"2026-08-14T00:51:35.636Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}