# Roof Layout Error (Lua runtime error)

**URL:** <https://discourse.stonehearth.net/t/roof-layout-error-lua-runtime-error/28420>\
**Category:** Bug Reports\
**Tags:** building, a20r701\
**Created:** [February 3, 2017, 5:35pm UTC](https://discourse.stonehearth.net/t/roof-layout-error-lua-runtime-error/28420 "2017-02-03T17:35:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Twichl](https://avatars.discourse-cdn.com/v4/letter/t/58956e/32.png) [@Twichl](https://discourse.stonehearth.net/u/Twichl)\
**Post date:** [February 3, 2017, 5:35pm UTC](https://discourse.stonehearth.net/t/roof-layout-error-lua-runtime-error/28420/1 "2017-02-03T17:35:48Z")

</div>

This error has started popping up recently. The error occurs when trying to place the roof or edit a placed roof. If I save the save and exit the game without finishing the plan- then reload the save I get this second error. Is there a work around or something I can do to solve the problem?  
After the initial error occurs I can’t continue to edit the roof (Only in certain directions at first then I can’t edit it at all), finalize the build plan, or remove the building.  
Most recent update, 64 bit, Steam game, Vanilla

_Initial Error:_  
release-701 (x64)  
…onehearth/components/building/building\_component.lua:806: attempt to call method ‘layout’ (a nil value)  
stack traceback:  
[C]: in function ‘layout’  
…onehearth/components/building/building\_component.lua:806: in function 'layout\_roof’  
stonehearth/services/server/build/build\_service.lua:1180: in function 'grow\_roof’  
stonehearth/services/server/build/build\_service.lua:1128: in function 'cb’  
stonehearth/services/server/build/build\_service.lua:1582: in function 'do\_command’  
stonehearth/services/server/build/build\_service.lua:1127: in function \<stonehearth/services/server/build/build\_service.lua:1125\>

release-701 (x64)  
c++ exception: lua runtime error  
stack traceback:

_Error on Reload:_  
release-701 (x64)  
…onehearth/components/building/building\_component.lua:727: attempt to index field ‘entity’ (a nil value)  
stack traceback:  
[C]: ?  
…onehearth/components/building/building\_component.lua:727: in function ‘\_compute\_total\_structures’  
…onehearth/components/building/building\_component.lua:130: in function \<…onehearth/components/building/building\_component.lua:117\>

release-701 (x64)  
c++ exception: lua runtime error  
stack traceback:
