Look up Cantara Loop in Northern California, a derailment caused a major environmental disaster back in 1991.
They've never really figured out how to stop derailments there, they still happen on a regular basis. We've just gotten lucky recently and the derailed cars weren't full of toxic chemicals.
https://www.ijpr.org/disasters-and-accidents/2022-11-17/four...