Alright, I think I've got it sorted out, sort of. Added some failsafes to prevent/recover from some of this, as well.
One more issue was Templar Flux Cores computing an "utility on market" of NaN, which... I'm not sure why that would be. The only thing that seems possible is if a mod set maxExoticUtilityAtRange to zero in the economy config. Since these flux cores are sharing a demand class with transplutonics, that was messing those up as well.
Edit: the weird thing is, recomputing the utility on market for the flux cores produced a normal, non-NaN value, so that's very confusing. I'm not sure how that calculation would change from whenever it first ran (and cached its NaN result) and when it ran again just now.)
The other stuff, still don't know why it'd happen.
Also, noticed some markets being added by code and not calling market.getLocation().set(primaryEntity.getLocationInHyperspace()). Which really the game should have been doing automatically, so, did that. This would screw up subtly all sorts of things...
Was having a look through the savefile and saw swathes of this kind of stuff, apparently in the "mothballed ships" sections of submarkets:
Spoiler
<FMmbr z="101778" o="0" sid="broadsword_wing" t="FIGHTER_WING" iF="false" id="469d9" sUN="false" civ="false" cCiv="false">
<crew z="101779">10000.0|0.0</crew>
<rT z="101780" cr="0.7" crPTM="0.0" sR="false" mo="false" lCR="false">
<m ref="101778"></m>
</rT>
</FMmbr>
<FMmbr z="101781" o="0" sid="istl_flare_wing" t="FIGHTER_WING" iF="false" id="1e0b9d" sUN="false" civ="false" cCiv="false">
<crew z="101782">10000.0|0.0</crew>
<rT z="101783" cr="0.99999994" crPTM="0.0" sR="false" mo="false" lCR="false">
<m ref="101781"></m>
</rT>
</FMmbr>
<FMmbr z="101784" o="0" sid="istl_zonedefbit_wing" t="FIGHTER_WING" iF="false" id="11bfa7" sUN="false" civ="false" cCiv="false">
<crew z="101785">10000.0|0.0</crew>
<rT z="101786" cr="0.99999994" crPTM="0.0" sR="false" mo="false" lCR="false">
<m ref="101784"></m>
</rT>
</FMmbr>
<FMmbr z="101787" o="0" sid="broadsword_wing" t="FIGHTER_WING" iF="false" id="b2224" sUN="false" civ="false" cCiv="false">
<crew z="101788">10000.0|0.0</crew>
<rT z="101789" cr="0.7" crPTM="0.0" sR="false" mo="false" lCR="false">
<m ref="101787"></m>
</rT>
</FMmbr>
<FMmbr z="101790" o="0" sid="istl_flare_wing" t="FIGHTER_WING" iF="false" id="174950" sUN="false" civ="false" cCiv="false">
<crew z="101791">10000.0|0.0</crew>
<rT z="101792" cr="0.84999996" crPTM="0.0" sR="false" mo="false" lCR="false">
<m ref="101790"></m>
</rT>
</FMmbr>
<FMmbr z="101793" o="0" sid="borer_wing" t="FIGHTER_WING" iF="false" id="6f8df823-4fc1-4ac0-98cf-0e9836fb2c4f" sUN="false" civ="false" cCiv="false">
<crew z="101794">10000.0|0.0</crew>
<rT z="101795" cr="0.7" crPTM="0.0" sR="false" mo="false" lCR="false">
<m ref="101793"></m>
</rT>
</FMmbr>
<FMmbr z="101796" o="0" sid="istl_flare_wing" t="FIGHTER_WING" iF="false" id="1a19f2" sUN="false" civ="false" cCiv="false">
<crew z="101797">10000.0|0.0</crew>
<rT z="101798" cr="0.772648" crPTM="0.0" sR="false" mo="false" lCR="false">
<m ref="101796"></m>
</rT>
</FMmbr>
Do you guys have any idea of why that might be? It's responsible for... well, actually, only about 300k of filesize, so probably not super important. It seems weird that something is adding a bunch of fighter wings to submarket cargo, though... and if that's unbounded, could be eventual trouble.