[15.37] Exception when calling script.raise_event

This subforum contains all the issues which we already resolved.
Karakaz
Inserter
Inserter
Posts: 22
Joined: Sat Jan 21, 2017 12:00 am
Contact:

[15.37] Exception when calling script.raise_event

Post by Karakaz »

Something weird is happening here.. please take a look.

https://mods.factorio.com/mods/Karakaz/ ... sion/21158

I added some lines in color-picker/control.lua to see what the parameters in to raise_event were:

Code: Select all

local function raise_event(which_event, params)
	[...]
	log(type(which_event) .. " : " .. type(params))
	
	for name,element in pairs(params) do
		log(name .. ", " .. type(element) .. ":" .. tostring(element))
	end
	
	script.raise_event(which_event, params)
end

Code: Select all

  68.513 Script @__color-picker__/control.lua:42: number : table
  68.513 Script @__color-picker__/control.lua:45: 1, table:table: 0x00007f0a5ceffb00
  68.513 Script @__color-picker__/control.lua:45: container, table:table: 0x00007f0a549273f0
  68.513 Script @__color-picker__/control.lua:45: color, table:table: 0x00007f0a66da1f10
  68.513 Script @__color-picker__/control.lua:45: hex_color, string:00FF00
  68.513 Script @__color-picker__/control.lua:45: player_index, number:1
  68.527 Error MainLoop.cpp:940: Exception at tick 5826475: Error while running event color-picker::on_gui_click (ID 1)
Can't copy object of type function
stack traceback:
	__color-picker__/control.lua:48: in function 'raise_event'
	__color-picker__/control.lua:126: in function 'raise_on_color_changed_event'
	__color-picker__/control.lua:137: in function 'raise_on_color_changed_event_255'
	__color-picker__/control.lua:1464: in function <__color-picker__/control.lua:1225>
Last edited by Karakaz on Fri Nov 17, 2017 10:03 pm, edited 1 time in total.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13171
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [15.37] Crash when calling script.raise_event

Post by Rseding91 »

Thanks for the report. I'm not seeing a crash. I see a lua error indicating you tried to pass a function through the event system which isn't supported and the game exited to the main menu.
If you want to get ahold of me I'm almost always on Discord.

Karakaz
Inserter
Inserter
Posts: 22
Joined: Sat Jan 21, 2017 12:00 am
Contact:

Re: [15.37] Exception when calling script.raise_event

Post by Karakaz »

My bad, updated the title now. It doesn't seem there is a function there, at least not in the first level of the params

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [15.37] Exception when calling script.raise_event

Post by eradicator »

Modify the function and post the result:

Code: Select all

local function raise_event(which_event, params)
   [...]
   log(type(which_event) .. " : " .. type(params))
   
   print(serpent.block(params)) -- this
   
   script.raise_event(which_event, params)
end
Also the search function on github can't find any mention of "raise_event" on your repository ...?
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Karakaz
Inserter
Inserter
Posts: 22
Joined: Sat Jan 21, 2017 12:00 am
Contact:

Re: [15.37] Exception when calling script.raise_event

Post by Karakaz »

Code: Select all

  58.323 Script @__color-picker__/control.lua:44: {
  {
    name = 152,
    tick = 5826223
  },
  color = {
    b = 0.6,
    g = 1,
    r = 0.2
  },
  container = {
    __self = "userdata: 0x00007f67987d92d0"
  },
  hex_color = "33FF99",
  player_index = 1
}
Thanks for that function ;) No, the code is from Mooncat's ColorPicker mod

There doesn't seem to be a function reference in there.. It is strange because it doesn't cause en exception when it is just mine and his working together. It is happening when there are certain other mods present.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [15.37] Exception when calling script.raise_event

Post by eradicator »

Karakaz wrote:Thanks for that function ;) No, the code is from Mooncat's ColorPicker mod

There doesn't seem to be a function reference in there.. It is strange because it doesn't cause en exception when it is just mine and his working together. It is happening when there are certain other mods present.
Well. As long as you can reproduce the error you might be able to find out where the function comes from. As i don't even know when or with what parameters raise_event is called there. And Mooncat doesn't seem to have a github so i can't check myself right now.
Last edited by eradicator on Sat Nov 18, 2017 5:29 pm, edited 1 time in total.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5148
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [15.37] Exception when calling script.raise_event

Post by Klonan »

Moved to modding help

I'm not seeing a crash, and Lua errors aren't bugs

If the game fully crashed because of the Lua code, please attach the full crash log here, with a code snippet that can reproduce the crash

Karakaz
Inserter
Inserter
Posts: 22
Joined: Sat Jan 21, 2017 12:00 am
Contact:

Re: [15.37] Exception when calling script.raise_event

Post by Karakaz »

The first argument is the number 152 (from script.generate_event_name())

The second argument is the table i posted before:

Code: Select all

{
  {
    name = 152,
    tick = 5826223
  },
  color = {
    b = 0.6,
    g = 1,
    r = 0.2
  },
  container = {
    __self = "userdata: 0x00007f67987d92d0"
  },
  hex_color = "33FF99",
  player_index = 1
}
There are no functions being sent into raise_event which is why this is so strange and why I think it should be considered as a bug and looked into by the developers.

To reproduce the exception, see Lezreth's last comment here https://mods.factorio.com/mods/Karakaz/ ... sion/21158

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [15.37] Exception when calling script.raise_event

Post by eradicator »

The instructions in that discussion do not reliably reproduce the error you say you're getting. Please provide additional info if you still need help. Steps i tried:
  1. Install two mods from mod portal (color-picker_0.4.4.zip, railway-painter_1.0.2.zip)
  2. Load existing factory savegame
  3. Research "Railway Painter"
  4. Click the lower one of the two new GUI buttons that appeared (tooltip is "Toggle Railway Painter Config")
  5. Click "New"
  6. Randomly click various of the color matrix tiles
  7. No error
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Karakaz
Inserter
Inserter
Posts: 22
Joined: Sat Jan 21, 2017 12:00 am
Contact:

Re: [15.37] Exception when calling script.raise_event

Post by Karakaz »

I'll list the whole process to anyone who wants to reproduce it:
  • 1. Download both savegame and mods from https://drive.google.com/drive/folders/ ... sp=sharing
    2. Navigate to .factorio directory
    3. Place Atarashi no Sekai.zip under saves
    4. Rename mods folder to something else temporarly
    5. Place the mods folder from mods.zip into .factorio directory
    6. Run factorio and load 'Atarashi no Sekai' save game
    7. Open RailwayPainter gui
    8. New
    9. Click a color
    10. Error appears

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5148
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [15.37] Exception when calling script.raise_event

Post by Klonan »

Karakaz wrote:I'll list the whole process to anyone who wants to reproduce it:
  • 1. Download both savegame and mods from https://drive.google.com/drive/folders/ ... sp=sharing
    2. Navigate to .factorio directory
    3. Place Atarashi no Sekai.zip under saves
    4. Rename mods folder to something else temporarly
    5. Place the mods folder from mods.zip into .factorio directory
    6. Run factorio and load 'Atarashi no Sekai' save game
    7. Open RailwayPainter gui
    8. New
    9. Click a color
    10. Error appears
With these steps, it seems obvious that it is probably an error somewhere on your side

To reproduce we will need a simple command we can copy paste to reproduce the error, to reduce any other variables

Karakaz
Inserter
Inserter
Posts: 22
Joined: Sat Jan 21, 2017 12:00 am
Contact:

Re: [15.37] Exception when calling script.raise_event

Post by Karakaz »

Ye, I know.. I'm just a bit frustrated because I can't figure it out, that's all :)

In any case, the error message isn't that helpful. Only reasonable explanation I can think of is that the exception originates deeper than the visible stack trace since there isn't a function being sent into raise_event.

Perhaps the third mod have created a function with the same id as the one color-picker is trying to raise. I don't know if that's even possible though..

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [15.37] Exception when calling script.raise_event

Post by eradicator »

Karakaz wrote:Ye, I know.. I'm just a bit frustrated because I can't figure it out, that's all :)
Bleh. I'm frustrated too now because i was actually stupid enough to waste lots of time on doing your work.
a) Downloading a huge modpack from a hosting service that is too fucking broken to show the file size before finishing download. had i know the thing was 200MB+ i wouldn't even have tried.
b) The modpack had half of the mods disabled in the first place. Please delete unnessecary garbage before uploading mods next time.
c) You didn't even bother to check if the bug occurs on a fresh map. Luckily i did, because i didn't want to risk downloading a whatever-MB sized map on a metered connection. →Yes, it errors on a fresh map too.
d) I still have no fucking clue why this is happening, but i know the minimum set of mods requried to reproduce this.

So. In order to make you learn something from this for next time i'm not gonna post the names of the other two mods required to reproduce this :P. Instead i'm going to link you to the wikipedia article on Binary Search which will tell you how to narrow down the list of responsible mods from 100+ to four. Be prepared to toggle lots of mods on and off again and restarting factorio all the time ;).

And maybe i'll have time to look at some of the code until you come back with the answer :P

----------------------------------------------
@Klonan: Would you be an angel and implement selecting more than one mod at a time for toggle on/off? Binary search is a pain when it needs two clicks to toggle each entry... (i can make a request post if required).
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Karakaz
Inserter
Inserter
Posts: 22
Joined: Sat Jan 21, 2017 12:00 am
Contact:

Re: [15.37] Exception when calling script.raise_event

Post by Karakaz »

Hehe initially I tried to disable some of the mods a couple of runs but there were so many so I couldn't be bothered. Didn't think of doing it using binary search, that's the way to go for sure and would have done it had I thought of it :)

Since you already have done it, let's not waste more time ay? ;)

User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1190
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: [15.37] Exception when calling script.raise_event

Post by Mooncat »

eradicator wrote:
Karakaz wrote:Ye, I know.. I'm just a bit frustrated because I can't figure it out, that's all :)
Bleh. I'm frustrated too now because i was actually stupid enough to waste lots of time on doing your work.
a) Downloading a huge modpack from a hosting service that is too fucking broken to show the file size before finishing download. had i know the thing was 200MB+ i wouldn't even have tried.
b) The modpack had half of the mods disabled in the first place. Please delete unnessecary garbage before uploading mods next time.
c) You didn't even bother to check if the bug occurs on a fresh map. Luckily i did, because i didn't want to risk downloading a whatever-MB sized map on a metered connection. →Yes, it errors on a fresh map too.
d) I still have no fucking clue why this is happening, but i know the minimum set of mods requried to reproduce this.

So. In order to make you learn something from this for next time i'm not gonna post the names of the other two mods required to reproduce this :P. Instead i'm going to link you to the wikipedia article on Binary Search which will tell you how to narrow down the list of responsible mods from 100+ to four. Be prepared to toggle lots of mods on and off again and restarting factorio all the time ;).

And maybe i'll have time to look at some of the code until you come back with the answer :P

----------------------------------------------
@Klonan: Would you be an angel and implement selecting more than one mod at a time for toggle on/off? Binary search is a pain when it needs two clicks to toggle each entry... (i can make a request post if required).
If you know which mods are causing the error, please don't hesitate to provide their names so we can investigate further. ;)

Karakaz
Inserter
Inserter
Posts: 22
Joined: Sat Jan 21, 2017 12:00 am
Contact:

Re: [15.37] Exception when calling script.raise_event

Post by Karakaz »

I went through the whole toggle mods process and found that the minimum number of mods to recreate the issue, apart from Railway Painter and Color Picker, is Picker Extended and Squeak Through.

I tried a couple of different things and found this:
  • * Removing all the code from Squeak Through had no effect.
    * I tried to check how ST was being used by PE by looking for it with grep and couldn't find where it was used.
    * Then I removed the optional dependency from PE's info.json and it magically worked without the exception.
    * After that I tried to remove all the code from PE but then the dependency didn't have any effect.
So to reproduce this: You need the four mods mentioned above. Removing ST from PE's optional dependencies toggles the exception somehow even if you have remove all the code from ST... something is really wierd here...

Karakaz
Inserter
Inserter
Posts: 22
Joined: Sat Jan 21, 2017 12:00 am
Contact:

Re: [15.37] Exception when calling script.raise_event

Post by Karakaz »

Could we move this back to bugs @Klonan?

Rseding91
Factorio Staff
Factorio Staff
Posts: 13171
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [15.37] Exception when calling script.raise_event

Post by Rseding91 »

Can you post a minimal save file and mods needed to reproduce the error? As a zip file.
If you want to get ahold of me I'm almost always on Discord.

Karakaz
Inserter
Inserter
Posts: 22
Joined: Sat Jan 21, 2017 12:00 am
Contact:

Re: [15.37] Exception when calling script.raise_event

Post by Karakaz »

No save file needed, only the four mods:

* Railway Painter
* Color Picker
* Picker Extended
* Squeak Through (Only the info.json needs to be present)

Removing/adding the optional dependency for Squeak Through in Picker Extended toggles the exception.

Railway Painter needs to be researched, then toggle the gui, create new rule and change color in the color picker interface.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13171
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [15.37] Exception when calling script.raise_event

Post by Rseding91 »

Karakaz wrote:No save file needed, only the four mods:

* Railway Painter
* Color Picker
* Picker Extended
* Squeak Through (Only the info.json needs to be present)

Removing/adding the optional dependency for Squeak Through in Picker Extended toggles the exception.

Railway Painter needs to be researched, then toggle the gui, create new rule and change color in the color picker interface.
Rseding91 wrote:... and mods needed to reproduce the error? As a zip file.
Please upload the mods needed as a zip.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Resolved Problems and Bugs”