{"record":{"id":"06aa4a5996c2ddc9","repo":"airbnb/lottie-android","slug":"expected-a-boolean-but-was-at-path","errorCode":null,"errorMessage":"Expected a boolean but was {} at path {}","messagePattern":"Expected a boolean but was (.+?) at path (.+?)","errorType":"exception","errorClass":"JsonDataException","httpStatus":null,"severity":"error","filePath":"lottie/src/main/java/com/airbnb/lottie/parser/moshi/JsonUtf8Reader.java","lineNumber":654,"sourceCode":"    pathIndices[stackSize - 1]++;\n    return result;\n  }\n\n  @Override public boolean nextBoolean() throws IOException {\n    int p = peeked;\n    if (p == PEEKED_NONE) {\n      p = doPeek();\n    }\n    if (p == PEEKED_TRUE) {\n      peeked = PEEKED_NONE;\n      pathIndices[stackSize - 1]++;\n      return true;\n    } else if (p == PEEKED_FALSE) {\n      peeked = PEEKED_NONE;\n      pathIndices[stackSize - 1]++;\n      return false;\n    }\n    throw new JsonDataException(\"Expected a boolean but was \" + peek() + \" at path \" + getPath());\n  }\n\n  @Override public double nextDouble() throws IOException {\n    int p = peeked;\n    if (p == PEEKED_NONE) {\n      p = doPeek();\n    }\n\n    if (p == PEEKED_LONG) {\n      peeked = PEEKED_NONE;\n      pathIndices[stackSize - 1]++;\n      return (double) peekedLong;\n    }\n\n    if (p == PEEKED_NUMBER) {\n      peekedString = buffer.readUtf8(peekedNumberLength);\n    } else if (p == PEEKED_DOUBLE_QUOTED) {\n      peekedString = nextQuotedValue(DOUBLE_QUOTE_OR_SLASH);","sourceCodeStart":636,"sourceCodeEnd":672,"githubUrl":"https://github.com/airbnb/lottie-android/blob/05ea92e90381eb8a8ae06855ea2b74f322bebbec/lottie/src/main/java/com/airbnb/lottie/parser/moshi/JsonUtf8Reader.java#L636-L672","documentation":"JsonUtf8Reader.nextBoolean() peeks the next token expecting PEEKED_TRUE or PEEKED_FALSE. Any other token type throws JsonDataException. This fires when the parser reads a boolean property (e.g., 'hd' hidden flag, 'ind' in some contexts, 'd' dash property) but the JSON contains a non-boolean value.","triggerScenarios":"A property expected to be a boolean (e.g., 'hd' for hidden layers, 'closed' for shape paths) is instead a number, string, null, object, or array in the Lottie JSON.","commonSituations":"Malformed Lottie JSON where a boolean field contains 0/1 instead of false/true (or vice versa); corrupted export; hand-edited file with type errors.","solutions":["Use the exception path to locate the field and ensure its value is a JSON boolean (true or false).","If the export tool uses 0/1 for booleans, re-export with correct boolean types.","Validate the JSON structure and re-download if corrupted."],"exampleFix":"// before — numeric 0/1 where boolean is expected\n{\"ty\":\"sh\",\"hd\":1,\"ks\":{...}}\n\n// after — proper JSON boolean\n{\"ty\":\"sh\",\"hd\":true,\"ks\":{...}}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"LottieTask<LottieComposition> task = LottieCompositionFactory.fromAsset(context, name);\ntask.addListener(result -> { /* success */ })\n     .addFailureListener(e -> { /* JSON boolean type error */ });","preventionTips":["Ensure boolean fields in Lottie JSON use true/false, not 0/1.","Validate with LottieFiles validator.","Use async LottieCompositionFactory APIs for graceful error handling."],"tags":["lottie","json-parsing","type-mismatch","boolean","json-data-exception"],"backgroundTag":null,"analyzedSha":"05ea92e90381eb8a8ae06855ea2b74f322bebbec","analyzedAt":"2026-08-14T00:51:35.636Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}