The mod Diesel Locomotive caused a non-recoverable error.
Please report this error to the mod author.
Error while running event Diesel-Locomotive::on_player_main_inventory_changed (ID 32) Diesel-Locomotive/control.lua:334: attempt to index local 'inventory' (a nil value)
stack traceback: Diesel-Locomotive/control.lua:334: in function <Diesel-Locomotive/control.lua:330>
Ok, I think I know now what you mean by sandbox (found it in the scenarios). This puts you into God mode, which in turn breaks a few things regarding inventory. I think, based on what evildogbot100 had written originally on the main page, at one point in time you could pull the fuel out without a crash. I don't know if there's been a change in Factorio or maybe I accidentally removed a key line to prevent the crash, but obviously that appears to be what's happening here.
I'll look into it and see what I can do, but for now please note that being able to remove the fuel while in God mode may not be preventable. As such, I strongly recommend against mining the locomotive while loaded with fuel or manually removing the fuel while in God mode. Use pumps to drain the locomotive that way.
EDIT: Bah, ok, it's regardless of the fuel, ie any kind of inventory interaction. Dang. I'll have to put something in to bypass this for now.