{"record":{"id":"9c2058415fada857","repo":"airbnb/lottie-android","slug":"cannot-find-marker-with-name","errorCode":null,"errorMessage":"Cannot find marker with name {}.","messagePattern":"Cannot find marker with name (.+?)\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"lottie/src/main/java/com/airbnb/lottie/LottieDrawable.java","lineNumber":1024,"sourceCode":"      lazyCompositionTasks.add(c -> setMaxProgress(maxProgress));\n      return;\n    }\n    animator.setMaxFrame(MiscUtils.lerp(composition.getStartFrame(), composition.getEndFrame(), maxProgress));\n  }\n\n  /**\n   * Sets the minimum frame to the start time of the specified marker.\n   *\n   * @throws IllegalArgumentException if the marker is not found.\n   */\n  public void setMinFrame(final String markerName) {\n    if (composition == null) {\n      lazyCompositionTasks.add(c -> setMinFrame(markerName));\n      return;\n    }\n    Marker marker = composition.getMarker(markerName);\n    if (marker == null) {\n      throw new IllegalArgumentException(\"Cannot find marker with name \" + markerName + \".\");\n    }\n    setMinFrame((int) marker.startFrame);\n  }\n\n  /**\n   * Sets the maximum frame to the start time + duration of the specified marker.\n   *\n   * @throws IllegalArgumentException if the marker is not found.\n   */\n  public void setMaxFrame(final String markerName) {\n    if (composition == null) {\n      lazyCompositionTasks.add(c -> setMaxFrame(markerName));\n      return;\n    }\n    Marker marker = composition.getMarker(markerName);\n    if (marker == null) {\n      throw new IllegalArgumentException(\"Cannot find marker with name \" + markerName + \".\");\n    }","sourceCodeStart":1006,"sourceCodeEnd":1042,"githubUrl":"https://github.com/airbnb/lottie-android/blob/05ea92e90381eb8a8ae06855ea2b74f322bebbec/lottie/src/main/java/com/airbnb/lottie/LottieDrawable.java#L1006-L1042","documentation":"Thrown by LottieDrawable#setMinFrame(String markerName) when the loaded LottieComposition does not contain a marker with the given name. Markers are named time ranges exported from After Effects; the animation engine needs a real marker to translate a name into a frame number.","triggerScenarios":"Calling setMinFrame(\"intro\") before the composition is loaded (deferred via lazyCompositionTasks, then resolved once composition is set) or with a marker name that does not exist in the composition's marker list; a typo or a renamed marker.","commonSituations":"Hardcoding a marker name that the design team later renamed in After Effects; loading a different composition variant that lacks the marker; setting markers before setComposition so the check is deferred and fails later.","solutions":["Confirm the marker name against the composition: inspect the JSON's \"markers\" array or call getComposition().getMarkers().","Use the exact marker name string exported by the artist (case-sensitive).","Guard with composition.getMarker(name) != null before calling setMinFrame.","Centralize marker names as constants shared with the design export."],"exampleFix":"// before\nlottieDrawable.setMinFrame(\"intro\"); // throws if absent\n\n// after\nMarker m = lottieDrawable.getComposition().getMarker(\"intro\");\nif (m != null) lottieDrawable.setMinFrame(\"intro\");","handlingStrategy":"validation","validationCode":"LottieComposition c = lottieDrawable.getComposition();\nif (c != null && c.getMarker(\"intro\") != null) {\n  lottieDrawable.setMinFrame(\"intro\");\n} else {\n  // fallback: numeric frame or skip\n}","typeGuard":"boolean hasMarker(LottieDrawable d, String name) {\n  return d.getComposition() != null && d.getComposition().getMarker(name) != null;\n}","tryCatchPattern":"try {\n  lottieDrawable.setMinFrame(markerName);\n} catch (IllegalArgumentException e) {\n  Log.w(TAG, \"marker not found: \" + markerName + \", falling back\");\n  lottieDrawable.setMinFrame(0);\n}","preventionTips":["Validate marker names against the composition before calling marker-based setters.","Store marker names as constants shared with the design team.","Set markers after setComposition so the check is not deferred."],"tags":["markers","composition","frames","api-misuse"],"backgroundTag":null,"analyzedSha":"05ea92e90381eb8a8ae06855ea2b74f322bebbec","analyzedAt":"2026-08-14T00:51:35.636Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}