logic_error: 'invalid reference in native get_id'

Title: Invalid reference error when starting construction of a new building.

Summary: When trying to order Hearthlings to start construction of a building (clicked build button) I get two errors:

develop-2720 (x64)
std::logic_error: 'invalid reference in native get_id'
stack traceback:
    [C]: ?
    [C]: in function 'get_id'
    ...nehearth/components/building/building_component.luac:354: in function '_get_entry_for_structure'
    ...nehearth/components/building/building_component.luac:318: in function '_compute_floor_dependencies'
    ...nehearth/components/building/building_component.luac:298: in function '_compute_dependencies'
    ...nehearth/components/building/building_component.luac:122: in function 'set_active'
    stonehearth/services/server/build/build_service.luac:39: in function 'set_active'
    stonehearth/call_handlers/build_call_handler.luac:5: in function <stonehearth/call_handlers/build_call_handler.luac:5>

And…

develop-2720 (x64)
c++ exception: lua runtime error
stack traceback:

I was able to build a different building prior to this. I used the undo button several times on this building and not on the earlier building. Additionally, this building was build up against a wall, while the other had some buffer space.

I loaded a previous save and was able to put the building directly against the wall, provided I adjusted the roof such that it no longer extended past the edge of the building on the side with the wall. This doesn’t explain the last time I got the error however, as last time the “wall” it was up against was only two blocks high.

Steps to reproduce:

  1. Design a building, undoing and changing things at least once.
  2. Place the building against a wall.
  3. Start construction.

Expected Results:
No error, Hearthlings begin construction of the building.

Actual Results:
Two errors as specified above. Hearthlings still start construction. Not sure if they finish or run into problems.

Versions and Mods:
Version 0.13.0 (develop 2720) x64 build
No mods installed.

System Information:
Windows 10, 64bit
Intel i7 4790K CPU
R9 270 discrete GPU
12GB RAM

Save File:
Download

Good evening @Timothy_Sassone, welcome to the Discourse! Awesome first post :thumbsup:, thank you so very much for completing the bug report completely, it is very helpful for the devs. Going to page @Albert to review this next week.

Glad I could help! My scrum team at work has been on bug fix duty for the past few sprints, and I’m gaining a whole new respect for a well written bug report as a result :stuck_out_tongue:

As more useful information goes, I just noticed a little while ago that, despite having “0” overhang on the cliff-facing side, my Hearthlings appear to have carved out a bit of space for the roof in the cliff wall. Not sure if it’s relevant, but I’ve provided screenshots, and can produce a save file if it would help.



I do not believe a save game will be needed for this, the screenshots are very clear! I am going to add @not_owen_wilson and @Ponder to this as well to review the new building overhang controls.