An order to halt months of industrial action that caused chaos across Sydney’s train network was made in error, a union has claimed in court.