When enabling a strategy it tries to cancel the orders. If the order is pending I receive an error message and the strategy is disabled.

How to cancel pending orders or avoiding this error?