airbnb/lottie-android · error · IllegalArgumentException

Cannot find marker with name {}.

Error message

Cannot find marker with name {}.

What it means

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.

Source

Thrown at lottie/src/main/java/com/airbnb/lottie/LottieDrawable.java:1024

      lazyCompositionTasks.add(c -> setMaxProgress(maxProgress));
      return;
    }
    animator.setMaxFrame(MiscUtils.lerp(composition.getStartFrame(), composition.getEndFrame(), maxProgress));
  }

  /**
   * Sets the minimum frame to the start time of the specified marker.
   *
   * @throws IllegalArgumentException if the marker is not found.
   */
  public void setMinFrame(final String markerName) {
    if (composition == null) {
      lazyCompositionTasks.add(c -> setMinFrame(markerName));
      return;
    }
    Marker marker = composition.getMarker(markerName);
    if (marker == null) {
      throw new IllegalArgumentException("Cannot find marker with name " + markerName + ".");
    }
    setMinFrame((int) marker.startFrame);
  }

  /**
   * Sets the maximum frame to the start time + duration of the specified marker.
   *
   * @throws IllegalArgumentException if the marker is not found.
   */
  public void setMaxFrame(final String markerName) {
    if (composition == null) {
      lazyCompositionTasks.add(c -> setMaxFrame(markerName));
      return;
    }
    Marker marker = composition.getMarker(markerName);
    if (marker == null) {
      throw new IllegalArgumentException("Cannot find marker with name " + markerName + ".");
    }

View on GitHub (pinned to 05ea92e903)

Solutions

  1. Confirm the marker name against the composition: inspect the JSON's "markers" array or call getComposition().getMarkers().
  2. Use the exact marker name string exported by the artist (case-sensitive).
  3. Guard with composition.getMarker(name) != null before calling setMinFrame.
  4. Centralize marker names as constants shared with the design export.

Example fix

// before
lottieDrawable.setMinFrame("intro"); // throws if absent

// after
Marker m = lottieDrawable.getComposition().getMarker("intro");
if (m != null) lottieDrawable.setMinFrame("intro");
Defensive patterns

Strategy: validation

Validate before calling

LottieComposition c = lottieDrawable.getComposition();
if (c != null && c.getMarker("intro") != null) {
  lottieDrawable.setMinFrame("intro");
} else {
  // fallback: numeric frame or skip
}

Type guard

boolean hasMarker(LottieDrawable d, String name) {
  return d.getComposition() != null && d.getComposition().getMarker(name) != null;
}

Try / catch

try {
  lottieDrawable.setMinFrame(markerName);
} catch (IllegalArgumentException e) {
  Log.w(TAG, "marker not found: " + markerName + ", falling back");
  lottieDrawable.setMinFrame(0);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of airbnb/lottie-android@05ea92e903 (2026-08-14). Data as JSON: /api/errors/9c2058415fada857. Report an issue: GitHub.