DanielKote / Foreman2

Visual planning tool for Factorio
Other
162 stars 16 forks source link

Error while importing new preset. #4

Closed cameronfrazier closed 2 years ago

cameronfrazier commented 2 years ago

Interesting tool I'd like to try out, but I had an issue however...

While trying to import a new preset to match my current game, an window appears stating that the export from Factorio could not be completed. Error Window

Foreman2 is running release titled "Foreman v2.0 - dev.4"

Factorio is running via Steam on Windows 10 Pro, using the latest Experimental release (1.1.45) Factorio Version and Build

The game loads fine and without any mod conflicts, so I'm not sure the source of the error. My current game is a SpaceX run, so there are a lot of mods.

Error Logs: errorlog.txt errorExporting.json.txt

Thanks, and please let me know if I can help figure out the issue.

DanielKote commented 2 years ago

This is now the second time I have heard about this issue, and unfortunately both times I cant reproduce it. For some reason the first part of the export doesnt complete, but the second part does. Could you please provide your config.ini file? It should be in: c:\ users \ name \ appdata \ roaming \ factorio \ config \ config.ini

DanielKote commented 2 years ago

Also, I switched out the export method, so give dev.5 a try and tell me what happens.

cameronfrazier commented 2 years ago

Thanks for the quick response.

I tried the dev.5 version (clean install) but encountered the same result.

Error Message_dev.5

Error Logs errorlog.txt errorExporting.json.txt

Factorio config.ini config.ini.txt

I then validated my local files and ensured I was locked to Factorio release 1.1.45, but I was still getting the same error.

DanielKote commented 2 years ago

thats unfortunate. Again please. I updated the dev.5, so just try it again.

cameronfrazier commented 2 years ago

Thanks again for the quick response.

No change with the new build. Again it was a clean install.

I also tried removing all mods other than base (run game, disable all mods, reload, exit, rename mods folder, run game, create new game and save so that the current is vanilla, exit), trying to see if there an issue isolated to a particular mod, but that had no effect and the error was still thrown.

Error logs are attached, including the related game log, just in case it helps you. factorio-current.log errorExporting.json.txt errorlog.txt

I'm not in a position right now to do a full/clean install of Factorio, but I can try that in a couple days maybe. Would there be a particular version of Factorio I should try? Something you know works?

Cheers,

DanielKote commented 2 years ago

Well, at this point I dont know what doesnt work, so I cant exactly recommend a working version - I have been trying to get the import to fail on my end for the better part of the day with no results. If you have time, could you try a few things? 1 - copy the mod (foremanexport_1.0.0) to your mods directory and try again. 2 - copy the mod again (it gets deleted after every import), find your factorio exe file (it should be in steam/steamapps/common/factorio/bin/x64), create a 'test.bat' file with the following line: "factorio.exe --verbose --instrument-mod foremanexport" (without any quotes), and run it. Steam will likely ask you if you really want to do this, so ok that and include the resulting factorio-current.log.

cameronfrazier commented 2 years ago

Hey, I ran those scenarios, plus a one with all of the SpaceX mods, seeing if I could trigger something interesting. No luck sadly.

I need to sign off for for the night, but can keep working on this on Monday. I'm starting to think it's a strange setting on my end, so I'll try a full re-install next week, see if we can't narrow down the issue. If you think of something I should try, please post it here and I'll give it a shot.

Cheers

Scenario 1:

Scenario 2:

Scenario 2+SpaceX:

DanielKote commented 2 years ago

Ok, I once again re-done the import process to include a compatibility mode. This should ignore the entire instrumental mode that I use in order to ensure I grab the data after all other mods have finished their job, and instead runs the import mod as a standard mod (just with an auto-created mod dependency list that includes all the mods in the target folder). If this still fails, I would probably have to give up on this seeing as how I have no way of reproducing the issue.

Give it a try - Dev.6, and be sure to check the 'compatibility mode' checkbox in the import window.

Thiske0 commented 2 years ago

I've had this problem or a similar one for me it was a problem with permissions moving the foreman install to C:\Users(urrent user)\AppData\Roaming\Foreman seemed to solve the problem for me.

DanielKote commented 2 years ago

Could you elaborate on that? which permissions? Does running the app in 'admin' work? I have been trying to figure out where the issue was for a while now, so any help would be appreciated.

Thiske0 commented 2 years ago

it was a expected issue because i ran it as a normal unprivileged user and it was located in C:\Program Files so when it tried writing a file it was off course denied

Thiske0 commented 2 years ago

however when i installed the latest version dev 6 it somehow produced the same error as mentioned here so it has to be an issue with something changed between dev 4 and 6 compat mode gave the same result going back to version 4 and it is working again (or at least getting to 96% but thats another promblem)

Thiske0 commented 2 years ago

ah of course running it once doesn't work for version 4 but the second time it does and for version 6 it fails both times wihout the data-final-fixes.lua however when added to version 4 it works first time but for version 6 it still fails its getting more confusing bye the minute lt however is behaving determenistic this means redeleting the data-final-fixes.lua from version 4 and relaunching it makes it not work the first time again but the second time it does. conclusion: it only works in version 4 with the data-final-fixes and without it after the second time. (its always about the foremanexport mod) note that these test are beig done in quick sucsession so this could change things regarding to the factorio side of this (since it seems factorio isn't fully unloaded after the first launch even accros versions)

DanielKote commented 2 years ago

well, data-final-fixes would cause version 4 to fail - that makes perfect sense (the output text structure is different), so the first time it would fail and the second time it would work (as in - without the data-final-fixes). So without any manual copying of files -

Thiske0 commented 2 years ago

yes thats true but the wierd thing is v 4 doesn't fail with the data-final-fixes even wierder it works first try instead of only after the second time

cameronfrazier commented 2 years ago

Hi @DanielKote, I'm back and have had a chance to do some tests (as well as starting to learn some of the ins and outs of Factorio modding...)

I had a chance to re-install the game this evening, and gave things another shot.

Running the latest version of Foreman2 results in the same error window: errorlog.txt errorExporting.json.txt

However... Loading the mod into Factorio, then running the game normally results in getting the output from the data-final-fixes factorio-current.log.dev8.manual_mod_install.txt I've been able to repeat this, so I think the P1 export is working in non-instrument mode.

Figuring out what is going on during instrument mode is a taking me a bit longer to figure out. Would you happen to have examples of working export log files, what Foreman is expecting, so I can have a look a bit more on my end? I'm worried that it's an issue particular to me, and I'd like to poke around a bit and see if I can get some better data for you, if it is not my system.

Thanks for all the help,

DanielKote commented 2 years ago

Ok, so I am basically 100% sure that the issue lies with caching the data stage of the game. If I look at the errorExporting files, in all situations the actual data.lua files are never processed (for you), and instead you have the following line: 0.240 Data stage cache loaded in: 0.226339 seconds. Naturally this means that anything that I do in the data stage of the mod exporter (icon export), will not happen because the game just goes 'here - we have done this before, so why not use it?'. And never does any of the logging text since its not really meant to be used in such a way. I am at the moment trying to get my setup to cache the files as well so I can get the error to happen, but for now could you go into your config.ini file and search for "cache-prototype-data" and ensure it is set to false? that might help out.

DanielKote commented 2 years ago

So, I finally managed to reproduce the issue, and I was right - it was the caching of the data stage. Give a try at Dev.9 version, and (hopefully) it should solve the issues. If so, I can finally close this issue!

cameronfrazier commented 2 years ago

Success!

Seems to work with both the cache turned on and off. I must have toggled that some time ago and forgot, I guess in the re-install I forgot to purge the settings...

Thanks for all the help in sorting out my issue!

Cheers

DanielKote commented 2 years ago

Yep - I made sure that during the first stage of the import (creating the temporary save file) it ensures that the export mod is NOT included in the mod list, which means that when the mod is added (and enabled) during the second stage of the import (when it actually needs to process the data and control stages), Factorio has no option but to ignore the cache and run the full data cycle. A bit convoluted, but I couldnt find anywhere in the Factorio commands how to force it to ignore cache (without changing the settings, and I kind of didnt want to touch them so as not to potentially impact the Factorio install). Wow. What a ride. Well, post a post on reddit when you get a cool enough graph built!

cameronfrazier commented 2 years ago

Nice solution. If it's convoluted and it works... it works! Thanks again!