This issue is easily reproduciple with "ammo-loader_18" mod (not this mod) by simply doing new map and then saving while in this mod everything seems fine - this is why i am calling it was posted under wrong mod.
In the other mod (with _18 suffix), in Factorio 0.18.27 or previous (when script data were serialised using serpent.dump) there was something like this in the script saved state (output of serpent.dump):
_.ItemDB.items["firearm-magazine"].effectsSummary.types[type]=0x5p+0;
_.ItemDB.items["piercing-rounds-magazine"].effectsSummary.types[type]=0x8p+0;
and here the "type" function is used as a key while the variable was being serialised. Using functions as key is now forbidden when such table can be reached from the global
because it cannot be serialised anymore.