The Transport Accident Investigation Commission has found a train driver who kept going despite maintenance work on the tracks was affected by prescription medication.
The freight train, travelling from Picton to Christchurch in August 2012, was meant to stop at Parikawa as track maintenance was being done between it and the next stop, Pines.
The driver continued to Pines but, fortunately, the maintenance crew had finished their work and taken their vehicle from the tracks.
An investigation found, if the work had not been complete, there would have been a high risk of a collision.
It concluded the train driver was affected by a number of medications prescribed to him for work- and non-work-related injuries.
The commission has recommended to the New Zealand Transport Agency that communication between private medical professionals and the rail industry be improved.