Crash when re-adding DynamicCuboid with the same prim_path after world.reset() and world.clear()

Isaac Sim Version

[√ ] 4.5.0

Operating System

[ √ ] Windows 10

GPU Information

  • Model: RTX 3060
  • Driver Version: 31.0.15.4612

Detailed Description

Hello, I’d like to report a bug that occurs when I try to clear the world and re-add an object. If I comment out world.reset(), the error doesn’t occur, but I don’t know why. Thanks in advance for looking into it.

Steps to Reproduce

from isaacsim import SimulationApp
simulation_app = SimulationApp({"headless": True}) 

from isaacsim.core.api import World
from isaacsim.core.api.objects import DynamicCuboid
import numpy as np

world = World()

fancy_cube =  world.scene.add(
    DynamicCuboid(
        prim_path="/World/FancyCube",
        name="FancyCube",
        position=np.array([0, 0, 1.0]),
        scale=np.array([0.5015, 0.5015, 0.5015]),
        color=np.array([0, 0, 1.0]),
    ))
world.reset() # If comment out this alone, there will be no error.
world.clear()

fancy_cube =  world.scene.add( # If comment out this alone, there will be no error.
    DynamicCuboid(
        prim_path="/World/FancyCube",
        name="FancyCube",
        position=np.array([0, 0, 1.0]),
        scale=np.array([0.5015, 0.5015, 0.5015]),
        color=np.array([0, 0, 1.0]),
    ))

simulation_app.close() 

Error log:

[20.437s] Simulation App Startup Complete
2025-06-09 07:28:37 [20,789ms] [Warning] [omni.physx.tensors.plugin] prim '/World/FancyCube' was deleted while being used by a shape in a 
tensor view class. The physics.tensors simulationView was invalidated.
2025-06-09 07:28:37 [20,789ms] [Warning] [omni.fabric.plugin] getTypes called on non-existent path /World/FancyCube
2025-06-09 07:28:37 [20,806ms] [Error] [omni.kit.app._impl] [py stderr]: Traceback (most recent call last):
2025-06-09 07:28:37 [20,807ms] [Error] [omni.kit.app._impl] [py stderr]:   File "D:\Fuzzing-Issac-Sim\my_application.py", line 22, in <module>
2025-06-09 07:28:37 [20,808ms] [Error] [omni.kit.app._impl] [py stderr]:     DynamicCuboid(
2025-06-09 07:28:37 [20,808ms] [Error] [omni.kit.app._impl] [py stderr]:   File "d:/isaacsim/exts/isaacsim.core.api/isaacsim/core/api/objects/cuboid.py", line 320, in __init__
2025-06-09 07:28:37 [20,809ms] [Error] [omni.kit.app._impl] [py stderr]:     FixedCuboid.__init__(
2025-06-09 07:28:37 [20,810ms] [Error] [omni.kit.app._impl] [py stderr]:   File "d:/isaacsim/exts/isaacsim.core.api/isaacsim/core/api/objects/cuboid.py", line 227, in __init__
2025-06-09 07:28:37 [20,810ms] [Error] [omni.kit.app._impl] [py stderr]:     VisualCuboid.__init__(
2025-06-09 07:28:37 [20,811ms] [Error] [omni.kit.app._impl] [py stderr]:   File "d:/isaacsim/exts/isaacsim.core.api/isaacsim/core/api/objects/cuboid.py", line 80, in __init__
2025-06-09 07:28:37 [20,811ms] [Error] [omni.kit.app._impl] [py stderr]:     raise Exception("The prim at path {} cannot be parsed as a Cube object".format(prim_path))
2025-06-09 07:28:37 [20,812ms] [Error] [omni.kit.app._impl] [py stderr]: Exception: The prim at path /World/FancyCube cannot be parsed as 
a Cube object
2025-06-09 07:28:37 [20,846ms] [Warning] [omni.graph.core.plugin] Could not find category 'Replicator:Annotators' for removal
2025-06-09 07:28:37 [20,847ms] [Warning] [omni.graph.core.plugin] Could not find category 'Replicator:Annotators' for removal
2025-06-09 07:28:37 [20,847ms] [Warning] [omni.graph.core.plugin] Could not find category 'Replicator:Annotators' for removal
2025-06-09 07:28:37 [20,848ms] [Warning] [omni.graph.core.plugin] Could not find category 'Replicator:Annotators' for removal
2025-06-09 07:28:37 [20,848ms] [Warning] [omni.graph.core.plugin] Could not find category 'Replicator:Annotators' for removal
2025-06-09 07:28:37 [20,849ms] [Warning] [omni.graph.core.plugin] Could not find category 'Replicator:Annotators' for removal
2025-06-09 07:28:37 [20,850ms] [Warning] [omni.graph.core.plugin] Could not find category 'Replicator:Annotators' for removal
2025-06-09 07:28:37 [20,851ms] [Warning] [omni.graph.core.plugin] Could not find category 'Replicator:Annotators' for removal
2025-06-09 07:28:37 [20,852ms] [Warning] [omni.graph.core.plugin] Could not find category 'Replicator:Annotators' for removal
2025-06-09 07:28:37 [20,852ms] [Warning] [omni.graph.core.plugin] Could not find category 'Replicator:Annotators' for removal
2025-06-09 07:28:37 [20,853ms] [Warning] [omni.graph.core.plugin] Could not find category 'Replicator:Annotators' for removal
2025-06-09 07:28:37 [20,854ms] [Warning] [omni.graph.core.plugin] Could not find category 'Replicator:Annotators' for removal
2025-06-09 07:28:37 [20,854ms] [Warning] [omni.graph.core.plugin] Could not find category 'Replicator:Core' for removal
2025-06-09 07:28:37 [20,875ms] [Warning] [omni.graph.core.plugin] Could not find category 'animation' for removal
2025-06-09 07:28:37 [20,881ms] [Warning] [omni.fabric.plugin] gFabricState->gUsdStageToSimStageWithHistoryMap had 1 outstanding SimStageWithHistory(s) at shutdown
2025-06-09 07:28:37 [20,883ms] [Warning] [carb.audio.context] 1 contexts were leaked
2025-06-09 07:28:37 [21,003ms] [Warning] [carb] Recursive unloadAllPlugins() detected!

Hi @Tommmmm,

I think this is a duplicate post from here: Adding New Object Fails After Previous Object Removal Due to Invalid Physics View

The answer is this: Delete prim from simulation and keep the simulation running - #6 by michalin

the conclusion is that, unfortunately, it is not possible to delete objects on the fly. You will need to call stop on the simulation context (e.g. world.stop()), delete the prims, then start simulation again. The reason for this is that right now when deleting a prim it is not possible to fully synchronize the event with the physics engine. To protect against faulty behaviors, when deleting a prim the simulation context is invalidated.

Thank you! So it’s not feasible to do something in the same world after calling world.clear? What I find strange is that after commenting out world.reset, the error no longer occurs.

The reason that taking reset() out making the error go away is because reset actually takes a simulation step. If you don’t reset, you would have not taking a simulation step yet, and the simulation view would have not been created before you cleared.

Hello!

We noticed that this topic hasn’t received any recent responses, so we are closing it for now to help keep the forum organized.

If you’re still experiencing this issue or have additional questions, please feel free to create a new topic with updated details. When doing so, we recommend mentioning or linking to this original topic in your new post—this helps provide context and makes it easier for others to assist you.

Thank you for being part of the NVIDIA Isaac Sim community.

Best regards,
The NVIDIA Isaac Sim Forum Team