{"record":{"id":"8ef27153d488c0eb","repo":"airbnb/lottie-android","slug":"expected-a-name-but-was-at-path","errorCode":null,"errorMessage":"Expected a name but was {} at path {}","messagePattern":"Expected a name 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":532,"sourceCode":"    }\n  }\n\n  @Override public String nextName() throws IOException {\n    int p = peeked;\n    if (p == PEEKED_NONE) {\n      p = doPeek();\n    }\n    String result;\n    if (p == PEEKED_UNQUOTED_NAME) {\n      result = nextUnquotedValue();\n    } else if (p == PEEKED_DOUBLE_QUOTED_NAME) {\n      result = nextQuotedValue(DOUBLE_QUOTE_OR_SLASH);\n    } else if (p == PEEKED_SINGLE_QUOTED_NAME) {\n      result = nextQuotedValue(SINGLE_QUOTE_OR_SLASH);\n    } else if (p == PEEKED_BUFFERED_NAME) {\n      result = peekedString;\n    } else {\n      throw new JsonDataException(\"Expected a name but was \" + peek() + \" at path \" + getPath());\n    }\n    peeked = PEEKED_NONE;\n    pathNames[stackSize - 1] = result;\n    return result;\n  }\n\n  @Override public int selectName(Options options) throws IOException {\n    int p = peeked;\n    if (p == PEEKED_NONE) {\n      p = doPeek();\n    }\n    if (p < PEEKED_SINGLE_QUOTED_NAME || p > PEEKED_BUFFERED_NAME) {\n      return -1;\n    }\n    if (p == PEEKED_BUFFERED_NAME) {\n      return findName(peekedString, options);\n    }\n","sourceCodeStart":514,"sourceCodeEnd":550,"githubUrl":"https://github.com/airbnb/lottie-android/blob/05ea92e90381eb8a8ae06855ea2b74f322bebbec/lottie/src/main/java/com/airbnb/lottie/parser/moshi/JsonUtf8Reader.java#L514-L550","documentation":"JsonUtf8Reader.nextName() peeks the next token expecting one of the name token types (unquoted, double-quoted, single-quoted, or buffered name). If the token is not a name — e.g., it's a value, closing bracket, or EOF — it throws JsonDataException. This fires when the parser is inside an object and expects a property key but encounters a value or structural token instead.","triggerScenarios":"Inside a JSON object, the parser expects a property name but finds a value, closing brace, comma, or EOF. This happens when object key-value pairs are malformed — e.g., a missing key before a value, or an extra value after the last property.","commonSituations":"Corrupted or hand-edited Lottie JSON with object key-value errors; truncated file; malformed export from a non-standard tool.","solutions":["Use the exception path to locate the malformed object in the JSON and fix the property key-value structure.","Run the JSON through a validator/linter.","Re-export or re-download the animation file."],"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 property name error */ });","preventionTips":["Validate Lottie JSON object structure with a linter.","Use async LottieCompositionFactory APIs.","Re-export or re-download corrupted animations."],"tags":["lottie","json-parsing","type-mismatch","property-name","json-data-exception"],"backgroundTag":null,"analyzedSha":"05ea92e90381eb8a8ae06855ea2b74f322bebbec","analyzedAt":"2026-08-14T00:51:35.636Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}