{"record":{"id":"5359234c7ebafc9a","repo":"airbnb/lottie-android","slug":"expected-a-string-but-was-at-path","errorCode":null,"errorMessage":"Expected a string but was {} at path {}","messagePattern":"Expected a string 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":633,"sourceCode":"    if (p == PEEKED_NONE) {\n      p = doPeek();\n    }\n    String result;\n    if (p == PEEKED_UNQUOTED) {\n      result = nextUnquotedValue();\n    } else if (p == PEEKED_DOUBLE_QUOTED) {\n      result = nextQuotedValue(DOUBLE_QUOTE_OR_SLASH);\n    } else if (p == PEEKED_SINGLE_QUOTED) {\n      result = nextQuotedValue(SINGLE_QUOTE_OR_SLASH);\n    } else if (p == PEEKED_BUFFERED) {\n      result = peekedString;\n      peekedString = null;\n    } else if (p == PEEKED_LONG) {\n      result = Long.toString(peekedLong);\n    } else if (p == PEEKED_NUMBER) {\n      result = buffer.readUtf8(peekedNumberLength);\n    } else {\n      throw new JsonDataException(\"Expected a string but was \" + peek() + \" at path \" + getPath());\n    }\n    peeked = PEEKED_NONE;\n    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]++;","sourceCodeStart":615,"sourceCodeEnd":651,"githubUrl":"https://github.com/airbnb/lottie-android/blob/05ea92e90381eb8a8ae06855ea2b74f322bebbec/lottie/src/main/java/com/airbnb/lottie/parser/moshi/JsonUtf8Reader.java#L615-L651","documentation":"JsonUtf8Reader.nextString() peeks the next token expecting a string-compatible value: double-quoted, single-quoted, buffered, or a number/long that can be coerced to string. Any other token type (boolean, null, object start, array start, EOF) triggers JsonDataException. This fires when the parser reads a string-typed property (e.g., layer name, refId, font family) but the JSON contains a non-string value.","triggerScenarios":"A property expected to be a string (e.g., 'nm' layer name, 'refId', 'fFamily' font family) is instead a number, boolean, null, object, or array in the Lottie JSON.","commonSituations":"Malformed Lottie JSON where a string field contains a non-string value; non-standard export tool; corrupted or hand-edited file.","solutions":["Use the exception path to locate the field and ensure its value is a JSON string.","Validate the animation with LottieFiles validator.","Re-export or re-download the animation."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"LottieTask<LottieComposition> task = LottieCompositionFactory.fromAsset(context, name);\ntask.addListener(result -> { /* success */ })\n     .addFailureListener(e -> { /* JSON string type error */ });","preventionTips":["Validate Lottie JSON with LottieFiles validator.","Use async LottieCompositionFactory APIs for graceful error handling.","Re-export from supported tool versions."],"tags":["lottie","json-parsing","type-mismatch","string","json-data-exception"],"backgroundTag":null,"analyzedSha":"05ea92e90381eb8a8ae06855ea2b74f322bebbec","analyzedAt":"2026-08-14T00:51:35.636Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}