A train video camera caught the moment a track worker narrowly avoided being struck by a train between Horley and Gatwick Airport stations.
The incident on 2 December 2018 was probed by the Rail Accident Investigation Branch.
The track worker was a controller of site safety (COSS) and was undertaking work related to the electrical isolation of conductor rails.
He moved out of the path of the train just before it reached him.
The RAIB found the Network Rail isolation planning process meant that BAM Nuttall planners lacked the information needed for them to establish the exact location at which work was to be carried out on the track.
The planners lacked the skills and experience needed to understand this and so provided a system of work which provided no protection from train movements at the actual location of the task.
The COSS recognised that the planned system of work lacked adequate protection from train movements, but undertook the task without implementing an alternative safe system of work.
A second track worker involved in the isolation task did not challenge the COSS about the unsafe method of working.
The RAIB has recommended that Network Rail should improve its isolation planning processes so that safe system of work planners receive the information they need to plan all associated work safely.
The RAIB has also recommended that BAM Nuttall should improve its safe system of work planning process to ensure that its planners do not plan work without sufficient information to identify appropriate protection measures.
Simon French, Chief Inspector of Rail Accidents said: “Once again the RAIB has to report on an alarming near-miss between a train and a track worker.”