Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while applying migration #125

Closed
TankFox opened this issue Dec 17, 2017 · 15 comments
Closed

Error while applying migration #125

TankFox opened this issue Dec 17, 2017 · 15 comments

Comments

@TankFox
Copy link

TankFox commented Dec 17, 2017

After installing robot army 0.3.4, trying to load up my existing map fails with;

Error while applying migration: Robot Army: robotarmy_0.2.1.lua

robotarmy/migrations/robotarmy_0.2.1.lua:21: attempt to index field 'rally-beacon' (a nil value)

@kyranf
Copy link
Owner

kyranf commented Dec 17, 2017

hm.. can you test for me quickly just deleting all the migration scripts? kind of weird that going from 0.3.3 to 0.3.4 would even trigger those scripts.. sorry about that. I didn't test every scenario like loading from a 0.3.3 game after upgrading to 0.3.4.

so that means unzipping the zip file to just be the folder, and then going into Migrations folder and deleting all the scripts in there.

@kyranf
Copy link
Owner

kyranf commented Dec 17, 2017

I just loaded up a test game i had on 0.15.37 with robot army 0.3.3 with the new 0.16.4 and robot army 0.3.4 and it didn't try to apply the migration scripts for me... what version of factorio and robot army did you have again??

@TankFox
Copy link
Author

TankFox commented Dec 17, 2017

I will see if I can figure out how to delete the migration script, but this is a brand new map that did not previously have robot army installed in any way.

when the new Factorio 1.16 came out I began a new map, and Robot Army was not enabled at all until you brought it up to date for 1.16. I think the issue is that the migration script is looking for something to migrate and not finding anything.

@TankFox
Copy link
Author

TankFox commented Dec 18, 2017

Yes, deleting the migration folder entirely allowed me to load my map!

To reiterate, I created this map after 1.16 came out but before Robot Army updated, and could not load the map due to the above error.

The map had never seen Robot Army before

@georgehank
Copy link

Same here, had the same error on a new 0.16-only install, so a new map that gains mods as they get updated to .16 and thus become available.

Which really is weird, since it then absolutely positively should trigger any migration scripts.

@kyranf
Copy link
Owner

kyranf commented Dec 18, 2017

migration scripts i thought were only meant to fire if the mod version is detected as updating, and it only runs certain scripts.

the reason why that migration script failed is because the rally point entity has been removed from the mod, but back in 0.2.1 or whatever the migration script is trying to run for, the mod had that entity..

Some of those migration scripts are sure to break things now, or reference things not in the mod anymore, I think I might clean out all the migration scripts and only put new ones in as required for that release only.

@kyranf kyranf closed this as completed Dec 18, 2017
@kyranf kyranf reopened this Dec 18, 2017
@kyranf
Copy link
Owner

kyranf commented Dec 18, 2017

Weird I just made a game without robot army enabled, saved it, went back and enabled robot army again and loaded up the save. No migration scripts tried to be applied? I can't reproduce this issue :(

@kyranf
Copy link
Owner

kyranf commented Dec 18, 2017

This could be a factorio bug where if a mod is first loaded, it just runs all the migration scripts anyway (which it shouldn't)

@kyranf
Copy link
Owner

kyranf commented Dec 18, 2017

yes make a 2nd issue please

@kyranf
Copy link
Owner

kyranf commented Dec 18, 2017

I worked out while I was trying to reproduce the issue i didn't successfully re-enable my mod. I got it to throw the error loading the mod for the first time into a 0.16 save game that was started without the mod. i will submit a bug report on the forums

@Astree13
Copy link

same bug here : started a new 0.16 game, and tried to load the mod after starting the game, got the migration error.
If I load the mod "before" creating a new game, it works fine. So the problem seams to be while loading the mod on an existing map.

@Hiestaa
Copy link

Hiestaa commented Jan 20, 2018

I'm no author of this mod, so take my comment with a grain of salt.

I faced the same issue migrating a map from Factorio 0.16.16 without robotarmy mod to Factorio 0.16.16 with the mod enabled.

I tried to get my hand dirty and un-zipped the mod to take a peak at the code that is erroring out, for the record it's the following lua instruction

for i, force in pairs(game.forces) do 
  -- [...]
  if force.technologies["military"].researched then
    -- [...]
    force.recipes["rally-beacon"].enabled=true
  • Why is the migration 0.2.1 run, and any of the other files?
  • Could it be that this rally-beacon doesn't exist in this version of the game?
  • Removing this last line from the migration script enabled me to load my map just fine (detailed instructions: unzip the mod, remove the line robotarmy_0.3.4\robotarmy_0.3.4\migrations\robotarmy_0.2.1.lua:21 and re-zip the whole folder). Could you release a version without this line or would it cause any foreseeable issue?

Thanks for great work 💟

@kyranf
Copy link
Owner

kyranf commented Jan 21, 2018

The quick and easy fix is to delete the entire migrations folder. turns out this behaviour is not a bug, supposedly every single migration leading up to the current version will be run in sequence if you add the mod fresh to an existing save game for the first time. It's illogical if you ask me, but that's what is causing this error right now.

I have removed the rally flag stuff from the mod, to declutter it and I don't intend on bringing it back anymore. It's a shame that it broke the mod like this, I bet hundreds of people have encountered the issue by now, I hope they see what is required by reading here..

I will release a new version which has the migrations removed for the users, plus a few minor additional things.

@OvermindDL1
Copy link

Yeah I just hit it myself on a scenario map as well.

@kyranf
Copy link
Owner

kyranf commented Apr 4, 2018

Fixed in current version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants