[2.1.9] LuaEntity::get_fluid_filter errors when trying to query fluid-wagon

Bugs which we just recently fixed in our development version and will reach you in the next release.
User avatar
Shemp
Long Handed Inserter
Long Handed Inserter
Posts: 54
Joined: Mon Jan 19, 2026 6:51 pm
Contact:

[2.1.9] LuaEntity::get_fluid_filter errors when trying to query fluid-wagon

Post by Shemp »

Fluid wagons have a fluids_count of 1, and it's usually safe to run get_fluid_* functions on an entity if their fluids_count is positive and the provided index falls within the bounds. (And get_fluid_segment_* functions are safe if you check that has_fluid_segment() is true.)

You can reproduce this error by doing the following:
  • Place a Fluid wagon in the world
  • Hover over the wagon with the mouse and run the following command
  • /c game.print(game.player.selected.fluids_count)
  • to verify the wagon's fluids_count = 1, and then run
  • /c filter = game.player.selected.get_fluid_filter(1)
This will print:
Error: Entity "fluid-wagon", (fluid-wagon) does not have fluids.

I expect the function to return nil.

Similarly, you also produce the error by calling set_fluid_filter. I would expect this function to silently fail as it does in cases, such as crafting machines, where a filter can't be set.

----------------------

EDIT: I'll also mention that this error does not occur on Flamethrower turrets. These have a fluids_count = 2, the second of which is an internal buffer with no associated FluidBox prototype.
Rseding91
Factorio Staff
Factorio Staff
Posts: 17134
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.1.9] LuaEntity::get_fluid_filter errors when trying to query fluid-wagon

Post by Rseding91 »

Thanks for the report. This is now fixed for the next release.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Resolved for the next release”