How to use get_error_event_stream()

I need to catch physx error to prevent crash

[Error] [omni.physx.plugin] PhysX error: PxD6JointCreate: actors must be different, FILE /buildAgent/work/99bede84aa0a52c2/source/physxextensions/src/ExtD6Joint.cpp, LINE 45

I see a function like this : get_error_event_stream

I try to create a subscription:

def _on_error_event(event):
                global can_continue
                can_continue = False

events = get_physx_interface().get_error_event_stream()
_error_event_sub = None
_error_event_sub = events.create_subscription_to_pop(_on_error_event)

However, this seems never get triggered. I am using a standalone application

The print message never shows. It just crash the entire program.

the error stream needs to get flushed first before you get the events. I suspect that the issue here is that the crash happens before the event stream is flushed.
What you can do though is to add a logger for the error logging directly using this interface:

logging = carb.logging.acquire_logging()

def log_fn(source, level, filename, line_number, message):
    if level >= carb.logging.LEVEL_WARN:

handler = logging.add_logger(log_fn)

Having said that, when do you get the error? We should have checks for these situations to prevent creating such a joints inside PhysX SDK. How can I repro this issue please?

this is from this issue:

the surface gripper is trying to grasp a part of the robot itself.

I mean it’s from ML model. I can’t control the prediction.


Do I need to provide a script with some numbers to reproduce it?

In this way I can get the message printed. However, I cannot keep running the simulation. I just want to catch the error and stop the simulation and run a different trial.

If it’s possbile to know what object the surface gripper is trying to grasp it might also help. However, unfortunately that part of the code is not open sourced.

Ok I see now, I think its too late when this msg is send. Asking IsaacSim people what we can do about this. From the physics side, its too late when this msg is send. You cant stop it anymore I think.

Thanks, a related question. Is it possible to not print warnings to the terminal?

It would be great the system will not easily crash in the future.