{"record":{"id":"5e1c2c65abce6e13","repo":"3b1b/manim","slug":"only-vmobjects-can-be-passed-into-vgroup","errorCode":null,"errorMessage":"Only VMobjects can be passed into VGroup","messagePattern":"Only VMobjects can be passed into VGroup","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"manimlib/mobject/types/vectorized_mobject.py","lineNumber":1397,"sourceCode":"        about_point: Vect3 | None = None,\n        **kwargs\n    ) -> Self:\n        rot_matrix_T = rotation_matrix_transpose(angle, axis)\n        self.apply_points_function(\n            lambda points: np.dot(points, rot_matrix_T),\n            about_point,\n            **kwargs\n        )\n        for mob in self.get_family():\n            mob.get_unit_normal(refresh=True)\n        return self\n\n\nclass VGroup(Group, VMobject, Generic[SubVmobjectType]):\n    def __init__(self, *vmobjects: SubVmobjectType | Iterable[SubVmobjectType], **kwargs):\n        super().__init__(**kwargs)\n        if any(isinstance(vmob, Mobject) and not isinstance(vmob, VMobject) for vmob in vmobjects):\n            raise Exception(\"Only VMobjects can be passed into VGroup\")\n        self._ingest_args(*vmobjects)\n        if self.submobjects:\n            self.uniforms.update(self.submobjects[0].uniforms)\n\n    def __add__(self, other: VMobject) -> Self:\n        assert isinstance(other, VMobject)\n        return self.add(other)\n\n    # This is just here to make linters happy with references to things like VGroup(...)[0]\n    def __getitem__(self, index) -> SubVmobjectType:\n        return super().__getitem__(index)\n\n\nclass VectorizedPoint(Point, VMobject):\n    def __init__(\n        self,\n        location: np.ndarray = ORIGIN,\n        color: ManimColor = BLACK,","sourceCodeStart":1379,"sourceCodeEnd":1415,"githubUrl":"https://github.com/3b1b/manim/blob/dee01804d47b9f94402d71472674710dcac125b8/manimlib/mobject/types/vectorized_mobject.py#L1379-L1415","documentation":"Raised by VGroup.__init__ (vectorized_mobject.py:1397) when any positional argument is an instance of Mobject but not of VMobject. Note the asymmetry with VMobject.add: non-Mobject arguments (e.g. an iterable of VMobjects, which _ingest_args expands) are allowed, but a concrete non-vectorized Mobject is rejected.","triggerScenarios":"VGroup(Group(...)), VGroup(Mobject()), VGroup(Point(...), Dot()) (Point is not a VMobject), or VGroup(Points()/a PMobject). Passing a plain list [Dot(), Dot()] does NOT raise because a list is not a Mobject; it is ingested instead.","commonSituations":"Nesting a Group inside VGroup for organizational purposes; passing a mixed list where one element is an ImageMobject or point-cloud mobject; copy-pasting Group construction into VGroup code during refactors.","solutions":["Replace the non-VMobject argument with a VMobject equivalent (Group -> VGroup, Point -> a vectorized dot or remove it)","Use Group(...) instead of VGroup(...) when you genuinely need to hold non-vectorized mobjects","Unpack iterables explicitly and verify each element with isinstance(m, VMobject) before constructing the VGroup"],"exampleFix":"# before\ninner = Group(Dot(), Circle())\nouter = VGroup(inner)  # Group is a Mobject, not a VMobject -> raises\n\n# after\ninner = VGroup(Dot(), Circle())\nouter = VGroup(inner)","handlingStrategy":"type-guard","validationCode":"flat = []\nfor arg in args:\n    flat.extend(arg if isinstance(arg, (list, tuple)) else [arg])\nassert all(isinstance(m, VMobject) for m in flat)\nvg = VGroup(*flat)","typeGuard":"from manimlib import VMobject, Mobject\n\ndef is_vmobject(m) -> bool:\n    return isinstance(m, VMobject) and not (isinstance(m, Mobject) and not isinstance(m, VMobject))","tryCatchPattern":null,"preventionTips":["Nest VMobjects only: convert Group -> VGroup before putting it inside a VGroup","Unpack iterables explicitly so every element is a VMobject","Run isinstance(m, VMobject) checks in helper builders that assemble VGroups dynamically"],"tags":["manim","vgroup","type-check","constructor"],"backgroundTag":null,"analyzedSha":"dee01804d47b9f94402d71472674710dcac125b8","analyzedAt":"2026-08-14T19:53:44.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}