# AI shutdown issues

**URL:** <https://discourse.stonehearth.net/t/ai-shutdown-issues/36413>\
**Category:** Resolved Reports\
**Tags:** resolved\
**Created:** [June 29, 2018, 5:39pm UTC](https://discourse.stonehearth.net/t/ai-shutdown-issues/36413 "2018-06-29T17:39:39Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![LadidaLP](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/ladidalp/32/62924_2.png) [@LadidaLP](https://discourse.stonehearth.net/u/LadidaLP)\
**Post date:** [June 29, 2018, 5:39pm UTC](https://discourse.stonehearth.net/t/ai-shutdown-issues/36413/1 "2018-06-29T17:39:39Z")

</div>

I wana say off the bat, This doesnt seem like the same issue as we’ve seen in previous builds (Named the Campfire idle bug)

i find myself in my current game playing happily along and occasionaly, jobs will stop being done, Hauling will not happen anymore (eventhough there’s plenty of storage options for them to deposit items in the world) etc.

a quick save -\> Reload will fix this issue, but it’s not been rooted out for sure.

i’m Currently at 26 hearthlings on the latest unstable build (R866)  
with the following mods (Brace yourself)  
TMD Templates  
Archipelago biome  
Autoharvest  
Better Storage (maybe needs to become not a mod at some point)  
Crafter Queues  
Footman Power Strike Rebalance  
Green mesa biome  
Sacred Grove Biome  
Hearthlings of many faces  
Important mood  
Stonehearth Doorways  
Locks of many hair (no colors)  
Mina’s Architecture Templates  
Miner Profession  
Poulty farm template  
Rivers  
Settlement Decor  
Smart Crafter  
World map size 160

The save is here if you want to see if there’s a root problem that just shapes itself like a timebomb to make such issues happen. i do not play with 3speed 95% of the time), i actually play on 1 speed most of the time to give the game time to cope and decide AI actions  
[1530293454673.rar](https://discourse.stonehearth.net/uploads/short-url/i3U9veKZF4Mb1dOqYyWcr0CUmTZ.rar) (6.5 MB)

Please ask me any questions you think are usefull for your investigations into these issues!  
(i think i played about 3-4 hours today, with 6-7 reloads~ total)

---

<div class="post-metadata">

**Author:** ![max99x](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/max99x/32/40094_2.png) [@max99x](https://discourse.stonehearth.net/u/max99x)\
**Post date:** [July 2, 2018, 10:52am UTC](https://discourse.stonehearth.net/t/ai-shutdown-issues/36413/2 "2018-07-02T10:52:04Z")

</div>

Thanks for reporting this and offering to help! The file in your post appears to be corrupted. Can you reupload it please? I’ve tried to reproduce the issue on a number of savefiles with no luck. If you encounter it again, the following would help us debug it:

- Pause the game, ensure that the performance indicator in the bottom right turns mostly light green (idle), then set it to speed 1.
- If that doesn’t fix it, select any hearthling and run the following commands in the Lua console (the blue **`>`** debug tool), then post the results here.
  - `stonehearth.inventory:get_inventory(e:get_player_id()):get_restock_director('restock')._errands`
  - `stonehearth.inventory:get_inventory(e:get_player_id()):get_restock_director('restock')._failed_items`
  - `stonehearth.inventory:get_inventory(e:get_player_id()):get_restock_director('restock')._restockable_items_queue:get_size()`
  - `stonehearth.inventory:get_inventory(e:get_player_id()):get_restock_director('input_bin')._errands`

- Select a hearthling who you think should be restocking but isn’t. Click on the AI debug tool (this may take a while to load). In the top right search box, type `execute_restock_errand`, and scroll to the line highlighted in light purple (see example below). Take a screenshot and post it here.  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/stonehearth/original/3X/2/1/219819f609c521cc0857ecfb9e6b6094fa232984.png)

---

<div class="post-metadata">

**Author:** ![LadidaLP](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/ladidalp/32/62924_2.png) [@LadidaLP](https://discourse.stonehearth.net/u/LadidaLP)\
**Post date:** [July 3, 2018, 10:17am UTC](https://discourse.stonehearth.net/t/ai-shutdown-issues/36413/3 "2018-07-03T10:17:22Z")

</div>

I inted to play today for a while, so ill let you know when it happens, execute the instructions and share the results.

Here’s the reupload (cuz you said the uploaded file was corrupt?)[1530612976011.rar](https://discourse.stonehearth.net/uploads/short-url/1OvnUR6IhHbYPM0jKMOlA3e3mZs.rar) (6.3 MB)

---

<div class="post-metadata">

**Author:** ![LadidaLP](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/ladidalp/32/62924_2.png) [@LadidaLP](https://discourse.stonehearth.net/u/LadidaLP)\
**Post date:** [July 3, 2018, 11:42am UTC](https://discourse.stonehearth.net/t/ai-shutdown-issues/36413/4 "2018-07-03T11:42:43Z")

</div>

@max99x

So i’m having trouble following your instructions i think, So i selected Lorn Wester, a proud Happy-villian.  
(you can see alot of hearthlings have decided to follow suit in his behavior)

When i type Execute\_restock\_errand in the searchbox of the ai debugger, alot of diffrent sections light up purple (Including the chilling around the hearth one at the very top that is also in green = Running)

 ![image](https://us1.discourse-cdn.com/flex022/uploads/stonehearth/original/3X/3/f/3fa64b82ae7c00066fe2e946648666b0d62c44b7.png)

this is about an hour or 2 into playing today.  
if you need me to find specific lines or something ill do my best, but i’ve not used your guys’ debugging tools be4 ^^

Here’s the save again, at the time im making these readings  
[Saved paused at the debugging time.rar](https://discourse.stonehearth.net/uploads/short-url/1ynrV4fwllJJdQ4qVKc5HGa2qi2.rar) (6.8 MB)

---

<div class="post-metadata">

**Author:** ![max99x](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/max99x/32/40094_2.png) [@max99x](https://discourse.stonehearth.net/u/max99x)\
**Post date:** [July 3, 2018, 11:45am UTC](https://discourse.stonehearth.net/t/ai-shutdown-issues/36413/5 "2018-07-03T11:45:18Z")

</div>

From the console on the left, can you select all the text and post it here? For the AI inspector on the right, some sections will be highlighted in light purple instead of dark purple - those are the ones that matter.

---

<div class="post-metadata">

**Author:** ![LadidaLP](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/ladidalp/32/62924_2.png) [@LadidaLP](https://discourse.stonehearth.net/u/LadidaLP)\
**Post date:** [July 3, 2018, 11:50am UTC](https://discourse.stonehearth.net/t/ai-shutdown-issues/36413/6 "2018-07-03T11:50:44Z")

</div>

i might’ve beansed it, cuz i reloaded cuz i wanted to continue on the save, i already notice 2 diffrences

The left console (The first command last time yielded no result at all ( { } ) ) and now it does.

And from memory ( i’m very sorry) there was no light purple sections in the right hand console, only dark purple, and non-tinted lines.

also, i can’t copy anything from the left hand console, Ctrl + C opens up the command thing at the top.  
scratch that, it does copy, but it only copies the last command you told me to put in there without any result in the copy mind you.

---

<div class="post-metadata">

**Author:** ![LadidaLP](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/ladidalp/32/62924_2.png) [@LadidaLP](https://discourse.stonehearth.net/u/LadidaLP)\
**Post date:** [July 3, 2018, 11:53am UTC](https://discourse.stonehearth.net/t/ai-shutdown-issues/36413/7 "2018-07-03T11:53:26Z")

</div>

![image](https://us1.discourse-cdn.com/flex022/uploads/stonehearth/original/3X/6/3/6371ba8c112e82ad7755fa1451934f2b6707f683.png)

THIS IS FROM IMMEDIATLY AFTER THE RELOAD AFTER HAVING IT ON 1 SPEED 5 SECONDS~

i’m sorry for replying so much, i panicked a little cuz i think i fucked up the debugging process for you

---

<div class="post-metadata">

**Author:** ![max99x](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/max99x/32/40094_2.png) [@max99x](https://discourse.stonehearth.net/u/max99x)\
**Post date:** [July 3, 2018, 12:02pm UTC](https://discourse.stonehearth.net/t/ai-shutdown-issues/36413/8 "2018-07-03T12:02:38Z")

</div>

Thanks for the help! That first screenshot did give me a lead, so see if this still happens in the next release.

---

<div class="post-metadata">

**Author:** ![LadidaLP](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/ladidalp/32/62924_2.png) [@LadidaLP](https://discourse.stonehearth.net/u/LadidaLP)\
**Post date:** [July 3, 2018, 12:35pm UTC](https://discourse.stonehearth.net/t/ai-shutdown-issues/36413/9 "2018-07-03T12:35:05Z")

</div>

Okay, Last reply i promise @max99x

after my last post i continued play. i noticed stuff was lieng around and people were partying at the campfire during the day again.

The left console:  
i cant copy paste all of it, cuz it doesn’t copy all of it.  
-Command 1 (stonehearth.inventory:get\_inventory(e:get\_player\_id()):get\_restock\_director(‘restock’).\_errands)

 ![image](https://us1.discourse-cdn.com/flex022/uploads/stonehearth/original/3X/6/7/670c85ed29850e31d7541169a9d3c7d74b1af2d1.png)  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/stonehearth/original/3X/c/8/c89e92ca589dd3ec1506e28f10aaf35bb4e56b49.png)  
(Does this like 4 times)

-Command 2  
a list of hundreds of thousands of items listed here under diffrent numbers.

-Command 3 & 4

 ![image](https://us1.discourse-cdn.com/flex022/uploads/stonehearth/original/3X/5/4/5453a9f8431f95901d75f7b932ae517d1617f3fb.png)

RIGHT HAND CONSOLE:  
i found 2 light purple highlighted areas.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/stonehearth/original/3X/8/b/8be150256a363e094fedff90770ec38b16ab29d1.png)  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/stonehearth/original/3X/4/6/466fa524e22f32042775b2abf0c7202389b6929b.png)

This is about half an hour since i reloaded, and posted here. i hope this was more along the lines of what you were looking for.

identical events since both reloads.  
I’ve rallied the town every time invaders appeared, and i’ve capped on town items and sold off a bunch of items to make room (at the time of these readings i’m at 3.6k out of 3.9k

I’m leaving my game paused in it’s current state without reloading incase you got more instructions for me

---

<div class="post-metadata">

**Author:** ![max99x](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/max99x/32/40094_2.png) [@max99x](https://discourse.stonehearth.net/u/max99x)\
**Post date:** [July 3, 2018, 12:39pm UTC](https://discourse.stonehearth.net/t/ai-shutdown-issues/36413/10 "2018-07-03T12:39:55Z")

</div>

Yeah, based on that info I think this should be fixed in the next version. I want to test it out on one of your savefiles, but unfortunately, all the ones in this thread fail to open in WinRAR. Can you try compressing them into a ZIP instead?

---

<div class="post-metadata">

**Author:** ![LadidaLP](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/ladidalp/32/62924_2.png) [@LadidaLP](https://discourse.stonehearth.net/u/LadidaLP)\
**Post date:** [July 3, 2018, 12:41pm UTC](https://discourse.stonehearth.net/t/ai-shutdown-issues/36413/11 "2018-07-03T12:41:57Z")

</div>

[a zip of the save at the current time as requested.zip](https://discourse.stonehearth.net/uploads/short-url/tKfqgICMlZgaGb3r4p736uFMUCy.zip) (9.6 MB)

let me know if i can continue play, or if you’d like me to leave it paused for a little bit incase you need me to do something else.

---

<div class="post-metadata">

**Author:** ![max99x](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/max99x/32/40094_2.png) [@max99x](https://discourse.stonehearth.net/u/max99x)\
**Post date:** [July 3, 2018, 12:42pm UTC](https://discourse.stonehearth.net/t/ai-shutdown-issues/36413/12 "2018-07-03T12:42:35Z")

</div>

Yup, that worked. Thanks! I’ll look into it.

---

<div class="post-metadata">

**Author:** ![megashub](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/megashub/32/47769_2.png) [@megashub](https://discourse.stonehearth.net/u/megashub)\
**Post date:** [July 3, 2018, 3:42pm UTC](https://discourse.stonehearth.net/t/ai-shutdown-issues/36413/13 "2018-07-03T15:42:18Z")

</div>

After validation, please confirm if this is indeed fixed for next build. 🙂

---

<div class="post-metadata">

**Author:** ![max99x](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/max99x/32/40094_2.png) [@max99x](https://discourse.stonehearth.net/u/max99x)\
**Post date:** [July 3, 2018, 4:36pm UTC](https://discourse.stonehearth.net/t/ai-shutdown-issues/36413/14 "2018-07-03T16:36:25Z")

</div>

I’ve added a bunch more robustness improvements to the system for the next release, but in the case of your savegame, after running it for a day, there’s simply no more storage that accepts wheat/silkweed, so your fields are still filled with those. If you add a stockpile, they immediately get to hauling.

---

<div class="post-metadata">

**Author:** ![LadidaLP](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/ladidalp/32/62924_2.png) [@LadidaLP](https://discourse.stonehearth.net/u/LadidaLP)\
**Post date:** [July 3, 2018, 5:30pm UTC](https://discourse.stonehearth.net/t/ai-shutdown-issues/36413/15 "2018-07-03T17:30:29Z")

</div>

thats fine, i just mass sold those every trader that came by.

and everytime i recorded the error, i checked wether towninventory was full or not, and if it was, sold off a bunch of stuff mainly silkweed and wheat, cuz i accumulated those the quickest. and i didnt report times where my town inventory was obviously full with 500 things lieng on the floor.
