I've had a similar problem with waterways from Cargo Ships mod (which are rails under the sea). I couldn't find the current source code to submit a patch, but I've fixed it myself. If you're a developer or you're a non-developer that's feeling adventurous, the bug report is up on GitHub here (https://github.com/Hermios/Factorio/issues/6). It's a two-line change, so it's pretty much just decompress the mod, find the file, and change the code. Best of luck.
I know guys, I try to improve migration, but struggle with it. The solution of Kagato works, but is not very pretty (Sorry no offense :) ), as some hidden items stay behind. I really try my best to solve it asap.
Thanks for the feedback
Error while running event RailPowerSystem::on_pre_player_mined_item (ID 11) RailPowerSystem/methods/globalEvents.lua:64: attempt to index field '?' (a nil value)
stack traceback: RailPowerSystem/methods/globalEvents.lua:64: in function 'OnRemoved' HermiosLibs/controlLib.lua:92: in function <HermiosLibs/controlLib.lua:86>