raiguard / RecipeBook

Recipe Book for Factorio.
MIT License
20 stars 9 forks source link

Crash on start up #85

Closed GeneralTanker closed 2 years ago

GeneralTanker commented 2 years ago

Mod crash on loading save

To Reproduce

1)Update mods in save to latest version 2)Load save 3) Crash

Name : GeneralTank

factorio-current.log

https://www.dropbox.com/s/21j81ja76l51wd6/Krastorio2%20SE7%2064%20K2%201.2.zip?dl=0

rdenison commented 2 years ago

I had this same crash. crash log was this:

Error while running event RecipeBook::on_string_translated (ID 151) __RecipeBook__/scripts/formatter.lua:61: attempt to concatenate local 'inner' (a nil value) stack traceback: __RecipeBook__/scripts/formatter.lua:61: in function 'rich_text' __RecipeBook__/scripts/formatter.lua:271: in function 'get_base_tooltip' __RecipeBook__/scripts/formatter.lua:525: in function <__RecipeBook__/scripts/formatter.lua:493> (...tail calls...) __RecipeBook__/scripts/gui/util.lua:94: in function 'update_list_box' __RecipeBook__/scripts/gui/search/root.lua:220: in function 'update_favorites' __RecipeBook__/scripts/gui/search/root.lua:166: in function 'build' __RecipeBook__/control.lua:471: in function <__RecipeBook__/control.lua:448>

I think it was caused by the grappling gun mod changing the recipe for the ammo. I updated Aircraft, better cargo planes, grappling gun, LTN, LTN Manager, SE, SE Graphics 1.

GeneralTanker commented 2 years ago

Look like Raiguard broke something with the update to Factorio Library downgrading it fixes the issue.

raiguard commented 2 years ago

image

I can't get it to load. Could you package and send me these two mods so I can reproduce this?

image

I've applied a band-aid fix for now that will cause it to use the internal name if the translation is missing. Once I can load your save, I'll figure out the proper fix.

dgattey commented 2 years ago

Also breaking for me when I tried to upgrade to latest version of LTN, LTN Manager, and flib at the same time. Recipe Book is already updated prior to this.

The mod Recipe Book (3.2.1) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event RecipeBook::on_string_translated (ID 151)
__RecipeBook__/scripts/formatter.lua:61: attempt to concatenate local 'inner' (a nil value)
stack traceback:
    __RecipeBook__/scripts/formatter.lua:61: in function 'rich_text'
    __RecipeBook__/scripts/formatter.lua:271: in function 'get_base_tooltip'
    __RecipeBook__/scripts/formatter.lua:525: in function <__RecipeBook__/scripts/formatter.lua:493>
    (...tail calls...)
    __RecipeBook__/scripts/formatter.lua:121: in function '?'
    __RecipeBook__/scripts/formatter.lua:336: in function 'get_tooltip_deets'
    __RecipeBook__/scripts/formatter.lua:541: in function <__RecipeBook__/scripts/formatter.lua:493>
    (...tail calls...)
    __RecipeBook__/scripts/gui/util.lua:94: in function 'update_list_box'
    __RecipeBook__/scripts/gui/search/root.lua:220: in function 'update_favorites'
    __RecipeBook__/scripts/gui/search/root.lua:166: in function 'build'
    __RecipeBook__/control.lua:471: in function <__RecipeBook__/control.lua:448>
dgattey commented 2 years ago

But I can confirm that the diff fixed it - but obviously the name is wrong now image

raiguard commented 2 years ago

@dgattey Could you send me your save file?

dgattey commented 2 years ago

https://www.icloud.com/iclouddrive/0HZMzuKYDCtgGOoCWo0RaVKCA

Here ya go, it's big + has lots of mods enabled. I saved after using my local version of this mod with your diff applied, so it may not still crash when opened with the current prod version of the mod, not sure.

fljsky commented 2 years ago

I'm using this mod with K2 and space exploration,but get some crash issue.

seems like some item without translation will cause this mod try to concatenate with a nil value.

fallback to internal name insead of player_data.translations[class][name] in scripts\formatter.lua line:268 maybe solve this problem.

kryojenik commented 2 years ago

Look like Raiguard broke something with the update to Factorio Library downgrading it fixes the issue.

I can confirm this finding. I am getting the same crashes, but reverting flib from 9.1 -> 9.0 resolves the issue.

kryojenik commented 2 years ago

I have a couple of saves - new games with limited mods: https://drive.google.com/drive/folders/1YDz1rmqp85Yq92dEwX12KSrUiOJvnqff?usp=sharing

LTN 1.16.7 Recipe Book 3.2.1 flib 0.9.1

LTN Manager 0.3.11 (NoCrash) LTN Manager 4.0 (Crash)

There seems to be an interaction (at least) with the combination of LTN Manager 4.0 (and above), flib 0.9.1 and Recipe Book (tested with 3.1.5, 3.2.0, and 3.2.1). And maybe this is more of an issue with LTN Manager than Recipe Book.

Since LTN Manager >= 4.0 depends on flib 0.9.1, reverting to 0.9.0 disabled LTN Manager in my earlier test -- thus no more crashing.

There may be more interactions with other mods, or maybe even some paths to crash with LTN Manager 0.3.11... I didn't test much past this specific repro.

Loading either of these synced save games should succeed. Even opening LTM Manager works. Open Recipe Book in the "Crash" save works. Once you try to search for something it will crash.

With flib 0.9.1 and LTN Manager 4.0, Recipe Book 3.1.5: The mod Recipe Book (3.1.5) caused a non-recoverable error. Please report this error to the mod author.

Error while running event RecipeBook::on_tick (ID 0) RecipeBook/scripts/formatter.lua:48: attempt to concatenate local 'inner' (a nil value) stack traceback: RecipeBook/scripts/formatter.lua:48: in function 'rich_text' RecipeBook/scripts/formatter.lua:276: in function 'get_base_tooltip' RecipeBook/scripts/formatter.lua:518: in function <RecipeBook/scripts/formatter.lua:484> (...tail calls...) RecipeBook/scripts/gui/search/actions.lua:220: in function '?' RecipeBook/scripts/gui/search/index.lua:11: in function 'handle_action' RecipeBook/control.lua:175: in function 'handle_gui_action' RecipeBook/control.lua:360: in function <RecipeBook/control.lua:353>

With flib 0.9.1 and LTN Manager 4.0, Recipe Book 3.2.1: The mod Recipe Book (3.2.1) caused a non-recoverable error. Please report this error to the mod author.

Error while running event RecipeBook::on_tick (ID 0) RecipeBook/scripts/formatter.lua:61: attempt to concatenate local 'inner' (a nil value) stack traceback: RecipeBook/scripts/formatter.lua:61: in function 'rich_text' RecipeBook/scripts/formatter.lua:290: in function 'get_base_tooltip' RecipeBook/scripts/formatter.lua:525: in function <RecipeBook/scripts/formatter.lua:493> (...tail calls...) RecipeBook/scripts/gui/search/actions.lua:223: in function '?' RecipeBook/scripts/gui/search/index.lua:11: in function 'handle_action' RecipeBook/control.lua:183: in function 'handle_gui_action' RecipeBook/control.lua:426: in function <RecipeBook/control.lua:419>

raiguard commented 2 years ago

Oh... oh no. OH NO.

image

I know exactly why this is happening. The dictionary module in flib is not properly handling multiple mods using it at once. LTN Manager's dictionaries are leaking into Recipe Book and vice versa!

Hopefully this won't be hard to fix. I'm just mad at myself more than anything.

raiguard commented 2 years ago

Well, that was actually pretty easy. A new version of flib will be released shortly that will fix this issue! Thank you all for the reports.

The diff for the fix: image