How to throw the fail trials

When I try to apply ray in a transportation environment ( combine with Flow and SUMO), there is a problem is that:

In some cases, there will be a collision between vehicles. Unfortunately, it cannot be avoided in sumo, and the trial will fail, which means that the horizon of this failed trial will not be equal to others.

ValueError: Cannot feed value of shape (88, 22) for Tensor ‘arg_0:0’, which has shape ‘(1500, 22)’
(the horizon of the fail trial is 88, for normal trial is 1500, and 22 is the observation space)

However, this is the trial that I don’t need during training ( in the real world, no such collision will happen). Is there any way to make the tune.run throw the errored trial running?( I tried soft_horizon, but doesn’t work)

Are you using RLlib?

If not, you could hypothetically wrap your training function in try-catch, and if the value error is raised, you can just exit the trial (by returning).