Skip to content

MLC110: Mobject.add(self) or a proven parent cycle

qual reports MLC110 for a direct self-addition (mob.add(mob) — Manim raises ValueError) and for an add call that provably closes a parent cycle: the child already contains the parent through its submobjects, so family traversal recurses forever at render time.

  • Default severity: error
  • Minimum confidence: certain
  • Implementation phase: 2
  • Fix: none

Cycle detection uses only definite (Present) parent/child events between singleton identities; a structural removal or any unresolved mutation of an involved mobject invalidates the tracked edges, so re-parenting after a removal stays silent.

Wrong

class Demo(Scene):
    def construct(self):
        dot = Dot()
        dot.add(dot)
        outer = VGroup()
        inner = VGroup()
        outer.add(inner)
        inner.add(outer)  # cycle
class Demo(Scene):
    def construct(self):
        first = VGroup()
        second = VGroup()
        dot = Dot()
        first.add(dot)
        second.add(dot)  # two parents, no cycle