A small boy almost fell from a moving train carriage on to the track below because the toilet floor was missing.
His mother was able to catch her son before he fell when she took him to the toilet on the Totnes Riverside to Buckfastleigh train in Devon.
The Rail Accident Investigation Branch (RAIB) has launched an investigation into the incident.
It said the floor had been removed for repairs to the carriage’s brakes but had not been replaced.
The 13:00 BST train was running between Staverton and Buckfastleigh on the South Devon Railway when the mother took her child to the toilet in the fourth carriage on 22 June.
The train was travelling at around 20 mph (32 km/h) when they opened the door and saw the floor of the compartment was missing, exposing the carriage wheels below.
She reported the incident to the guard of the train and the door was locked.
The mother and child were left shocked and the boy suffered minor bruising.
Staff had previously placed a notice on the door and attempted to secure it to prevent it being opened, but those measures were not effective, the RAIB said.
The investigation, which will look at the repairs to the carriage, the adequacy of the measures to secure the door and the railway’s systems for assuring the safety of rolling stock in service, will be published in due course.
A registered charity, South Devon Railway is a 7-mile former Great Western Railway branch line which runs steam trains and heritage rolling stock as a tourist attraction.
South Devon Railway has been approached for a comment.