[Klonan] [2.1.12] Crash calling LuaCommandable.set_command() (BuildBaseBehavior::prepareBuilding)

This subforum contains all the issues which we already resolved.
Luamaniemi
Manual Inserter
Manual Inserter
Posts: 1
Joined: Wed Jul 29, 2026 3:01 pm
Contact:

[Klonan] [2.1.12] Crash calling LuaCommandable.set_command() (BuildBaseBehavior::prepareBuilding)

Post by Luamaniemi »

OS: Windows 11 x64 25h2 build 26200.8973
Factorio version: 2.1.12
DLCs: no

Description:
Crash in BuildBaseBehavior::prepareBuilding (Access Violation 0x000000000BADC0DE) when calling LuaCommandable.set_command inside on_build_base_arrived. The Lua event handler itself completes fully, but the game immediately crashes afterward.

The issue is not reproduced in 2.0.77
The issue is reproduced in vanilla and with space age dlc
factorio-previous.log attached

Minimal code that causes the crash (the relevant mod is attached):

Code: Select all

function set_command_function(event)
    local biter_group = event.group
    biter_group.set_command({
        type = defines.command.go_to_location,
        destination_entity = storage.crash_chest
    })
end

function register_chest(event)
    storage.crash_chest = event.entity
end

local event_filter =
{{filter = "name", name = "commandable-crash-test-chest"}}
script.on_event(defines.events.on_built_entity, register_chest, event_filter)
script.on_event(defines.events.on_build_base_arrived, set_command_function)
Steps to reproduce:
  1. Load the game with the attached mod or other implementation of the script above.
  2. Place the test entity (commandable-crash-test-chest).
  3. Allow a biter group to trigger a base build expansion.
  4. When on_build_base_arrived fires and biter_group.set_command is invoked, and the game crashes seemingly on the same tick after the Lua event handler returns
Expected Behavior:
No crash lol
Attachments
factorio-previous.log
(11.38 KiB) Downloaded 20 times
set-command-bug-report_0.1.0.zip
(1.5 KiB) Downloaded 17 times
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5519
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [Klonan] [2.1.12] Crash calling LuaCommandable.set_command() (BuildBaseBehavior::prepareBuilding)

Post by Klonan »

Luamaniemi wrote: Wed Jul 29, 2026 4:27 pm Expected Behavior:
No crash lol
Thanks for the report, and welcome to the forum

It is now fixed for an upcoming release (most likely the next)
Post Reply

Return to “Resolved Problems and Bugs”