Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: [0.95a-RC15] Odd save load failure  (Read 3096 times)

Histidine

  • Admiral
  • *****
  • Posts: 4661
    • View Profile
    • GitHub profile
[0.95a-RC15] Odd save load failure
« on: June 10, 2021, 11:41:31 PM »

UPDATE: See solution in this post


Recently, at least three people on the Discord have experienced an unusual error with a save failing to load.

Sample error:
Spoiler

51291 [Thread-3] INFO  com.fs.starfarer.loading.LoadingUtils  - Loading CSV data from [DIRECTORY: C:\Users\Yonik\Desktop\Starsector 0.95a\starsector-core\..\mods\Nexerelin]
51311 [Thread-3] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Error loading
51311 [Thread-3] ERROR com.fs.starfarer.campaign.save.CampaignGameManager  - Failed calling method
---- Debugging information ----
message             : Failed calling method
cause-exception     : java.lang.NullPointerException
cause-message       : null
method              : com.fs.starfarer.campaign.fleet.FleetMember.readResolve()
class               : com.fs.starfarer.campaign.fleet.FleetMember
required-type       : com.fs.starfarer.campaign.fleet.FleetMember
converter-type      : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
line number         : 425180
class[1]            : java.util.HashMap
converter-type[1]   : com.thoughtworks.xstream.converters.collections.MapConverter
class[2]            : com.fs.starfarer.campaign.ModAndPluginData
class[3]            : com.fs.starfarer.campaign.CampaignEngine
converter-type[2]   : com.fs.starfarer.campaign.save.I
version             : not available
-------------------------------
com.thoughtworks.xstream.converters.ConversionException: Failed calling method
---- Debugging information ----
message             : Failed calling method
cause-exception     : java.lang.NullPointerException
cause-message       : null
method              : com.fs.starfarer.campaign.fleet.FleetMember.readResolve()
class               : com.fs.starfarer.campaign.fleet.FleetMember
required-type       : com.fs.starfarer.campaign.fleet.FleetMember
converter-type      : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
line number         : 425180
class[1]            : java.util.HashMap
converter-type[1]   : com.thoughtworks.xstream.converters.collections.MapConverter
class[2]            : com.fs.starfarer.campaign.ModAndPluginData
class[3]            : com.fs.starfarer.campaign.CampaignEngine
converter-type[2]   : com.fs.starfarer.campaign.save.I
version             : not available
-------------------------------
   at com.thoughtworks.xstream.core.util.SerializationMembers.callReadResolve(SerializationMembers.java:82)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unma rshal(AbstractReflectionConverter.java:282)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
   at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:70)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
   at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.rea dItem(AbstractCollectionConverter.java:73)
   at com.thoughtworks.xstream.converters.collections.MapConverter.putCurrentEntryInt oMap(MapConverter.java:110)
   at com.thoughtworks.xstream.converters.collections.MapConverter.populateMap(MapConverter.java:98)
   at com.thoughtworks.xstream.converters.collections.MapConverter.populateMap(MapConverter.java:92)
   at com.thoughtworks.xstream.converters.collections.MapConverter.unmarshal(MapConverter.java:87)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
   at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:70)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
   at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.rea dItem(AbstractCollectionConverter.java:73)
   at com.thoughtworks.xstream.converters.collections.MapConverter.putCurrentEntryInt oMap(MapConverter.java:110)
   at com.thoughtworks.xstream.converters.collections.MapConverter.populateMap(MapConverter.java:98)
   at com.thoughtworks.xstream.converters.collections.MapConverter.populateMap(MapConverter.java:92)
   at com.thoughtworks.xstream.converters.collections.MapConverter.unmarshal(MapConverter.java:87)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
   at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:70)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
   at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.rea dItem(AbstractCollectionConverter.java:73)
   at com.thoughtworks.xstream.converters.collections.MapConverter.putCurrentEntryInt oMap(MapConverter.java:110)
   at com.thoughtworks.xstream.converters.collections.MapConverter.populateMap(MapConverter.java:98)
   at com.thoughtworks.xstream.converters.collections.MapConverter.populateMap(MapConverter.java:92)
   at com.thoughtworks.xstream.converters.collections.MapConverter.unmarshal(MapConverter.java:87)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
   at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:70)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unma rshallField(AbstractReflectionConverter.java:503)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUn marshal(AbstractReflectionConverter.java:429)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unma rshal(AbstractReflectionConverter.java:281)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
   at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:70)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unma rshallField(AbstractReflectionConverter.java:503)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUn marshal(AbstractReflectionConverter.java:429)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unma rshal(AbstractReflectionConverter.java:281)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
   at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:70)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
   at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
   at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1486)
   at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1466)
   at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1346)
   at com.fs.starfarer.campaign.save.CampaignGameManager.o00000(Unknown Source)
   at com.fs.starfarer.campaign.save.CampaignGameManager.o00000(Unknown Source)
   at com.fs.starfarer.title.TitleScreenState.menuItemSelected(Unknown Source)
   at com.fs.starfarer.title.Object.actionPerformed(Unknown Source)
   at com.fs.starfarer.ui.newnew.buttonPressed(Unknown Source)
   at com.fs.starfarer.ui.I.Ò00000(Unknown Source)
   at com.fs.starfarer.ui.I.processInput(Unknown Source)
   at com.fs.starfarer.ui.Stringsuper.super(Unknown Source)
   at com.fs.starfarer.BaseGameState.traverse(Unknown Source)
   at com.fs.state.AppDriver.begin(Unknown Source)
   at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher.o00000(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
   at com.fs.starfarer.api.impl.campaign.econ.impl.BaseIndustry.getSupply(BaseIndustry.java:734)
   at com.fs.starfarer.api.impl.campaign.econ.impl.BaseIndustry.supply(BaseIndustry.java:316)
   at com.fs.starfarer.api.impl.campaign.econ.ResourceDepositsCondition.apply(ResourceDepositsCondition.java:193)
   at com.fs.starfarer.campaign.econ.Market.reapplyConditions(Unknown Source)
   at com.fs.starfarer.campaign.CharacterStats.refreshAllOutpostsEffectsForPlayerOutp osts(Unknown Source)
   at com.fs.starfarer.campaign.CharacterStats.refreshCharacterStatsEffects(Unknown Source)
   at com.fs.starfarer.api.impl.hullmods.PhaseField.onFleetSync(PhaseField.java:63)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getCommander(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetMember.updateStats(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetMember.readResolve(Unknown Source)
   at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at com.thoughtworks.xstream.core.util.SerializationMembers.callReadResolve(SerializationMembers.java:78)
   ... 63 more

[close]

The stack trace goes through some strange places, to say the least:
Code
Caused by: java.lang.NullPointerException
at com.fs.starfarer.api.impl.campaign.econ.impl.BaseIndustry.getSupply(BaseIndustry.java:734)
at com.fs.starfarer.api.impl.campaign.econ.impl.BaseIndustry.supply(BaseIndustry.java:316)
at com.fs.starfarer.api.impl.campaign.econ.ResourceDepositsCondition.apply(ResourceDepositsCondition.java:193)
at com.fs.starfarer.campaign.econ.Market.reapplyConditions(Unknown Source)
at com.fs.starfarer.campaign.CharacterStats.refreshAllOutpostsEffectsForPlayerOutposts(Unknown Source)
at com.fs.starfarer.campaign.CharacterStats.refreshCharacterStatsEffects(Unknown Source)
at com.fs.starfarer.api.impl.hullmods.PhaseField.onFleetSync(PhaseField.java:63)
at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
at com.fs.starfarer.campaign.fleet.FleetData.getCommander(Unknown Source)
at com.fs.starfarer.campaign.fleet.FleetMember.updateStats(Unknown Source)
at com.fs.starfarer.campaign.fleet.FleetMember.readResolve(Unknown Source)
Is stuff being loaded out of order (so it tries to sync the player fleet before the industries get their supply fields regenerated)?
Is there a user-side way to fix this?
« Last Edit: July 10, 2021, 07:58:18 AM by Histidine »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: [0.95a-RC15] Odd save load failure
« Reply #1 on: June 11, 2021, 11:59:10 AM »

Hmm - due to some changes to how phase field works, this shouldn't be an issue in the next release.

As far as a user-side fix... I'm not sure. The only thing that comes to mind is replacing the PhaseField hull mod effect with a copy whose onFleetSync() method just doesn't call refreshCharacterStatsEffects(). That method would still get called from other places so the worst you'd get out of this is occasionally slightly incorrect sensor profiles.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4661
    • View Profile
    • GitHub profile
Re: [0.95a-RC15] Odd save load failure
« Reply #2 on: June 12, 2021, 11:29:11 PM »

As far as a user-side fix... I'm not sure. The only thing that comes to mind is replacing the PhaseField hull mod effect with a copy whose onFleetSync() method just doesn't call refreshCharacterStatsEffects(). That method would still get called from other places so the worst you'd get out of this is occasionally slightly incorrect sensor profiles.
That seems to work, thanks!

For anyone searching for this issue and finding this thread, I've made a quick fix mod.
Download
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: [0.95a-RC15] Odd save load failure
« Reply #3 on: June 13, 2021, 11:10:44 AM »

(Nice!)
Logged

pearagon

  • Ensign
  • *
  • Posts: 25
  • im into resting
    • View Profile
Re: [0.95a-RC15] Odd save load failure
« Reply #4 on: June 23, 2021, 08:25:17 PM »

As far as a user-side fix... I'm not sure. The only thing that comes to mind is replacing the PhaseField hull mod effect with a copy whose onFleetSync() method just doesn't call refreshCharacterStatsEffects(). That method would still get called from other places so the worst you'd get out of this is occasionally slightly incorrect sensor profiles.
That seems to work, thanks!

For anyone searching for this issue and finding this thread, I've made a quick fix mod.
Download
This fixed it for me. Thank you so much!
Logged

Dumpshock

  • Ensign
  • *
  • Posts: 2
    • View Profile
Re: [0.95a-RC15] Odd save load failure
« Reply #5 on: June 28, 2021, 03:47:28 AM »

As far as a user-side fix... I'm not sure. The only thing that comes to mind is replacing the PhaseField hull mod effect with a copy whose onFleetSync() method just doesn't call refreshCharacterStatsEffects(). That method would still get called from other places so the worst you'd get out of this is occasionally slightly incorrect sensor profiles.
That seems to work, thanks!

For anyone searching for this issue and finding this thread, I've made a quick fix mod.
Download

I would like to add my +1 to running across this issue randomly, and add my thanks for the fix that you put together, Histidine.  You saved my save!
Logged

Yargast

  • Ensign
  • *
  • Posts: 5
    • View Profile
Re: [0.95a-RC15] Odd save load failure
« Reply #6 on: June 29, 2021, 05:03:44 AM »

Hi,
I had smilar error and this fix actually worked. What would be the sourse of this problem a mod?
And its odd that game worked like 2 weeks without any problems.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4661
    • View Profile
    • GitHub profile
Re: [0.95a-RC15] Odd save load failure
« Reply #7 on: June 29, 2021, 05:56:17 PM »

Update: I've recently found that the error can still occur with the fix mod, from a hullmod that extends the base game's phase field hullmod class.

I think someone needs to figure out which mod is causing the issue. Alex, is it possible to modify starfarer_api (or whichever jar has the relevant code) to log the class name of each object as it's deserialized during the game load process?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: [0.95a-RC15] Odd save load failure
« Reply #8 on: June 29, 2021, 06:52:07 PM »

I think someone needs to figure out which mod is causing the issue. Alex, is it possible to modify starfarer_api (or whichever jar has the relevant code) to log the class name of each object as it's deserialized during the game load process?

Hmm - I *think* the way to go here would be to write a custom
com.thoughtworks.xstream.converters.Converter
That doesn't actually want to handle anything, but logs the name of the class about to be converted, since it'll be *asked* if it can handle it. So it'd always return false from canConvert(), but would do the logging there instead.

And then in the ModPlugin.configureXStream() method you'd:
x.registerConverter(new CustomConverter());
Logged

eddyboi

  • Ensign
  • *
  • Posts: 1
    • View Profile
Re: [0.95a-RC15] Odd save load failure
« Reply #9 on: July 03, 2021, 03:54:05 AM »

 8) Worked for me as well, thanks so much i appreciate that there are people like you out there putting in work to help others.
Absolute champ
Logged

Fye

  • Ensign
  • *
  • Posts: 1
    • View Profile
Re: [0.95a-RC15] Odd save load failure
« Reply #10 on: July 07, 2021, 09:30:27 PM »

The fix worked for me! I was very confused about how a several day old playthrough was suddenly broken. As for the phase hull mods, I'd begin with ship packs that add new phase ships, like Caymon's Ship Pack or High Tech Expansion that adds several phase ships. The only other mod that would come to mind that doesn't necessarily mess with hullmods but adds modifiers is Starship legends, which does have several phase orientated traits.

I'm not really experienced with dissecting and debugging mod errors so I'll leave that to people who do, but I thought that maybe I'd throw in my 2 cents and maybe get the ball rolling. Thanks again for that quick patch, really did me a favor in saving my save.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4661
    • View Profile
    • GitHub profile
Re: [0.95a-RC15] Odd save load failure
« Reply #11 on: July 10, 2021, 07:57:33 AM »

Found out that the issue is caused by old versions of the Fleet Action History mod (fixed in 1.0.6).

Instructions to rescue existing save, if my fix mod doesn't work.
Logged