Genesis-Embodied-AI/genesis-world · error · ValueError

`morph` in hybrid entity should be either URDF or Mesh

Error message

`morph` in hybrid entity should be either URDF or Mesh

What it means

A HybridEntity is built from a `morph` that must describe the rigid part as either a URDF model or a Mesh; these are the only two morph types carrying the geometry needed to instantiate the rigid half. Any other morph type (plane, sphere, box, terrain, scene, SDF, ...) falls into the else branch and is rejected with this ValueError.

Source

Thrown at genesis/engine/entities/hybrid_entity.py:112

            # load mesh in the same way as the soft entity
            mesh = load_mesh(morph.file)

            # instantiate rigid part
            if material.func_instantiate_rigid_from_soft is None:
                func_instantiate_rigid_from_soft = default_func_instantiate_rigid_from_soft
            else:
                func_instantiate_rigid_from_soft = material.func_instantiate_rigid_from_soft
            part_rigid = func_instantiate_rigid_from_soft(
                scene=scene,
                mesh=mesh,
                morph=morph,
                material_rigid=material_rigid,
                material_hybrid=material,
                surface=surface_rigid,
            )

        else:
            raise ValueError("`morph` in hybrid entity should be either URDF or Mesh")

        if not material.use_default_coupling:
            # get rigid-soft association function
            if material.func_instantiate_rigid_soft_association is None:
                if isinstance(morph, gs.morphs.URDF):
                    func_instantiate_rigid_soft_association = default_func_instantiate_rigid_soft_association_from_rigid
                elif isinstance(morph, gs.morphs.Mesh):
                    func_instantiate_rigid_soft_association = default_func_instantiate_rigid_soft_association_from_soft
            else:
                func_instantiate_rigid_soft_association = material.func_instantiate_rigid_soft_association
            muscle_group, link_idcs, geom_idcs, trans_local_to_global, quat_local_to_global = (
                func_instantiate_rigid_soft_association(part_rigid=part_rigid, part_soft=part_soft)
            )
            if muscle_group is not None:
                muscle_group = muscle_group.astype(gs.np_int, copy=False)

            # set muscle group
            material_soft.n_groups = len(link_idcs)

View on GitHub (pinned to 56e4aa5d82)

Solutions

  1. Use a `gs.morphs.Mesh(file=...)` or `gs.morphs.URDF(file=...)` morph for the hybrid entity's rigid part.
  2. If you wanted a primitive rigid shape, use a plain RigidEntity instead of HybridEntity.

Example fix

# before
entity = scene.add_entity(
    morph=gs.morphs.Box(size=(0.5, 0.5, 0.5)),
    material=gs.materials.Hybrid,...
)

# after
entity = scene.add_entity(
    morph=gs.morphs.Mesh(file="part.obj"),
    material=gs.materials.Hybrid,...
)
Defensive patterns

Strategy: type-guard

Validate before calling

import genesis as gs
morph = gs.morphs.Box(size=(0.5, 0.5, 0.5))
if not isinstance(morph, (gs.morphs.URDF, gs.morphs.Mesh)):
    raise TypeError("HybridEntity morph must be URDF or Mesh")

Type guard

def is_hybrid_morph(morph) -> bool:
    import genesis as gs
    return isinstance(morph, (gs.morphs.URDF, gs.morphs.Mesh))

Prevention

When it happens

Trigger: `scene.add_entity(gs.entities.HybridEntity(morph=..., ...))` where morph is any gs.morphs type other than URDF or Mesh (e.g. gs.morphs.Plane, gs.morphs.Box, gs.morphs.Terrain, gs.morphs.Scene).

Common situations: Copy-pasting a plain rigid-entity example (often with morphs.Plane ground) and swapping the entity class to HybridEntity; trying to build a hybrid entity from primitives instead of a mesh/URDF asset.

Understand the failure class

Background: Invalid argument type errors: "must be of type string", "expected X, got Y", and ERR_INVALID_ARG_TYPE explained — this error's family across 15 libraries.

Related errors


AI-assisted analysis of Genesis-Embodied-AI/genesis-world@56e4aa5d82 (2026-08-28). Data as JSON: /api/errors/ab5565950f0efe44. Report an issue: GitHub.