3b1b/manim · error · Exception
All submobjects must be of type PMobject
Error message
All submobjects must be of type PMobject
What it means
Raised by PGroup.__init__ (point_cloud_mobject.py:104) when any of the positional arguments passed to PGroup is not an instance of PMobject. PGroup is the point-cloud analogue of VGroup and enforces that all its children share the PMobject data model (points + rgba arrays).
Source
Thrown at manimlib/mobject/types/point_cloud_mobject.py:104
sm.data.array for sm in self.get_family()
]))
return self
def point_from_proportion(self, alpha: float) -> np.ndarray:
index = alpha * (self.get_num_points() - 1)
return self.get_points()[int(index)]
def pointwise_become_partial(self, pmobject: PMobject, a: float, b: float) -> Self:
lower_index = int(a * pmobject.get_num_points())
upper_index = int(b * pmobject.get_num_points())
self.set_data(pmobject.data[lower_index:upper_index])
return self
class PGroup(PMobject):
def __init__(self, *pmobs: PMobject, **kwargs):
if not all([isinstance(m, PMobject) for m in pmobs]):
raise Exception("All submobjects must be of type PMobject")
super().__init__(**kwargs)
self.add(*pmobs)
View on GitHub (pinned to dee01804d4)
Solutions
- Use Points(...)/other PMobject instances inside PGroup instead of VMobjects like Dot or Circle
- If you actually wanted a group of dots, use VGroup(Dot(...)) (vectorized) rather than PGroup
- Validate with isinstance(m, PMobject) on each element before constructing
Example fix
# before pg = PGroup(Dot(), Dot()) # Dot is a VMobject -> raises # after pg = PGroup(Points([[-1, 0, 0], [1, 0, 0]]))
Defensive patterns
Strategy: type-guard
Validate before calling
assert all(isinstance(m, PMobject) for m in pmobs), 'PGroup needs PMobjects only' pg = PGroup(*pmobs)
Type guard
from manimlib.mobject.types.point_cloud_mobject import PMobject
def is_pmobject(m) -> bool:
return isinstance(m, PMobject) Prevention
- Use VGroup for vectorized dots; reserve PGroup for Points/PMobject subclasses
- Check isinstance(m, PMobject) on dynamically-built element lists
- Remember Dot/Circle are VMobjects and never valid inside PGroup
When it happens
Trigger: PGroup(Dot(), Points()) raises because Dot is a VMobject, not a PMobject; PGroup(VGroup()) and PGroup(Mobject()) also raise. Only point-cloud mobjects such as Points / PMobject subclasses are accepted.
Common situations: Assuming the familiar VGroup API accepts anything and writing PGroup(Dot(...)); migrating scenes between vectorized and point-cloud styles while reusing container code.
Related errors
- All submobjects must be of type VMobject
- Only VMobjects can be passed into VGroup
- Invalid color type
- Unsupported: {path_verb}
- At least 2 mobjects needed for Union.
AI-assisted analysis of 3b1b/manim@dee01804d4 (2026-08-14).
Data as JSON: /api/errors/232259782e774e55.
Report an issue: GitHub.