Hundreds of items show in inventory but not in the world

caused_by_mod

#1

So I have this weird bug and I am unsure if it is because of a mod or if it is in the base game (I’ll do more testing when I feel more willing) BUT it seems that my town inventory keeps getting cluttered with ghost items.

What I mean by ghost items is they are counted in the town inventory but don’t exist in the world and can’t be used. I’m not talking furniture, I mean resources, usually food and lately wood. My town inventory says I have a stock of over 100 of something but only 20 or less available to craft. This causes me a ton of problems especially as I reach the town limit with 30 hearthlings running about.

My question is as the title, is there a way to clear a certain selection of item from the town inventory? I would much rather just clear all the excess and start from scratch. At least until I can pinpoint the issue.


#2

afaik the town inventory refers to world items and not only for your stockpiled items
check if there are lots of stuff everywhere
with the debug tools i have no idea how to destroy groups of items but you can set a stockpile of wood close to any crowded wood area and after filling it set the heartling to destroy everything inside as an example


#3

There is nothing in the world laying around. I keep it fairly clean since if I don’t I get slowed down tremendously. These extra items aren’t even marked as being usable for crafting or anything. The food never spoils and disappears. So far it is just numbers with no physical presence in my world.


#4

hmmm, looks like a nice bug there :neutral_face:
try uploading the save for devs and players to check it out


#5

We have seen reports of this bug but haven’t investigated it thoroughly yet. If you can upload a save with this issue, it may help us find and fix the cause. In the meantime, you can try running dump_inaccessible_items in the game console (opened using Ctrl+C by default).


#6

Amazing, that did exactly what I hoped it would.
Here is the save file I was using (pre dump): The_Hoard.zip (6.6 MB)
It spit over 1k items on the floor of my flag, that was kind of glorious watching everyone clean it.
I am going to start a fresh game after this one and add mods one by one to see if there is any that starts this to happen, unless you guys find it first of course.
Thank you so much, this makes playing longer games so much more bearable.


#7

Thanks for the savefile, @Kenndalizard. This is the second report of hundreds of items (including non placeable ones) that we get. It’s very strange, we’re still not sure why it’s happening.

When using the “dump_inaccessible_items” command, always make sure to save/load first just in case, since it might not detect the missing items.


#8

I am also having this bug. I am beginning to suspect that it is once again my Miner mod that’s doing this.

The suspicion is because when the miner is levelled up enough to use a backpack, the backpack “reflects” the items the Miner has in his inventory, by reading the items, and creating duplicates of those items in the backpack’s own storage component. After the Miner drops or otherwise lets go of the item, the backpack deletes the copy it held onto. I know it does this, because I’ve never seen miners running around with a stuffed backpack that doesn’t empty itself. I’ve also checked on my “broken” save file (with over 900 items that do not appear in the world) whether the backpacks or the miners hold any references to the hidden items – they do not. But I wonder if maybe the cloned items automatically start belonging to the player, going into their town inventory, and then are never “cleared out” of it once the miner drops or no longer possesses these items? I’ll run a few tests with Microworld to see if my theory is correct that it’s the Miner causing this.

e: My hunch is correct. I spawned 3 miners and 100 rabbit jerkies that I had them load into a stockpile. After they were finished, there were now 198 jerkies. Researching why this is happening.

e2: I fixed the issue on my end by manually pulling up the miner owner’s town inventory, and force-deleting the “ghost” item from that inventory. It appears that stonehearth:storage:add_item notifies the player inventory that the item is added, but stonehearth:storage:remove_item does not notify the player inventory that the item was removed; this makes sense, since normally, removing an item from a storage inventory would not remove it from the town inventory.

@Kenndalizard, this issue will be fixed for you as soon as the Miner auto-updates from Steam, but you will need to start a new game. :frowning: I appreciate your bug report and your patience with my code.


#9

Thank you very much for your investigation, @Moai :smiley:
This was puzzling us.


#10

Is this happening with all the professions? I don’t have any miners in my town but I’ve been getting ghost items (mostly fencing) in my game as well.


#11

Not as far as I know. It could be a different mod, though.


#12

Hmm. Oh well. Is there any way to delete the ghost items?


#13

You can try Ctrl+C and dump_inaccessible_items.

However, if this problem was caused by the miner, there are no easy ways that don’t involve knowing Lua, I’m afraid. You will need to start a new game.


#14

Its awesome that you found some solution to it. That saves me at least one thing to look for while I do my own testing as I have other bugs to sort out.

Glad to hear that something was found though, I enjoy the miner mod. The little profession makes things easier and another quick runner is always nice to me.