Remove storage area - std::logic_error: 'invalid reference in native get_id'

Title:
Removing 1x1 storage area designation results in a long error that I do not understand at all.
Summary:
I was going to designate an area to store things. I didn’t like where I was putting it, so I reduced it to 1x1, placed, it then clicked on it and clicked the red X to remove. Got this errors.
Steps to reproduce:
1)
2)
3)

Expected Results:
Removal of designated storage 1x1 voxel.
Actual Results:

release-489 (x64)
std::logic_error: 'invalid reference in native get_id'
stack traceback:
	[C]: in function 'get_id'
	stonehearth/services/server/inventory/inventory.luac:304: in function 'is_storage_for_filter_fn'
	stonehearth/ai/actions/restock_storage_action.luac:7: in function 'filter_fn'
	stonehearth/ai/actions/find_path_to_entity_type.luac:21: in function <stonehearth/ai/actions/find_path_to_entity_type.luac:21>
	[C]: ?
	[C]: in function 'start'
	stonehearth/services/server/ai/compound_action.luac:125: in function <stonehearth/services/server/ai/compound_action.luac:122>
	[C]: ?
	[C]: in function 'start'
	...onehearth/services/server/tasks/run_task_action.luac:56: in function <...onehearth/services/server/tasks/run_task_action.luac:53>
	[C]: ?
	...
	[C]: ?
	[C]: in function 'start'
	stonehearth/services/server/ai/compound_action.luac:125: in function <stonehearth/services/server/ai/compound_action.luac:122>
	[C]: ?
	[C]: in function 'run'
	stonehearth/components/ai/ai_component.luac:186: in function '_thread_main'
	stonehearth/services/server/threads/thread.luac:90: in function <stonehearth/services/server/threads/thread.luac:89>
	[C]: in function 'xpcall'
	stonehearth/services/server/threads/thread.luac:89: in function 'f'
	radiant/lib/env.luac:8: in function <radiant/lib/env.luac:8>

Notes:

Attachments:

Version Number and Mods in use:

System Information:

If you do it again, does the error pop again ?

I have been unsuccessful in replicating. That probably means I am not repeating the exact steps that caused the issue, but I’ll try to be more aware if it happens again. I think it had to do with previously declaring storage, and when I tried to do more, I may have overlapped some. But it wasn’t showing, and they were not storing stuff. There was just one blue square on the ground.

2 Likes

I think someone was going to put an item there, and when you removed he could not find it anymore, causing the error?

Could be. If that is the case, then I guess they need to trap that condition in the code so an error doesn’t pop up, but rather a message window or something indicating what happened. I know it’s alpha. Just trying to help squash bugs. :slightly_smiling:

I’m on a peaceful game in the forest with the forest hearthlings, day one. I started on plains, dug down one level to get dirt surface. Had my carpenter make 2 farming staffs. I made two farmers and put the crops in the dirt. I then made the storage but it was too small so I removed it and that’s when I got the error. I have no mods and the steam version. I’ve removed the storage several times without errors but this is the first time I removed them in dirt.

ETA. Not able to repeat the error when I deleted the storage after quitting and restarting the game.

release-489 (x64)
std::logic_error: 'invalid reference in native get_id’
stack traceback:
[C]: in function 'get_id’
stonehearth/services/server/inventory/inventory.luac:304: in function 'is_storage_for_filter_fn’
stonehearth/ai/actions/restock_storage_action.luac:7: in function 'filter_fn’
stonehearth/ai/actions/find_path_to_entity_type.luac:21: in function <stonehearth/ai/actions/find_path_to_entity_type.luac:21>
[C]: ?
[C]: in function 'start’
stonehearth/services/server/ai/compound_action.luac:125: in function <stonehearth/services/server/ai/compound_action.luac:122>
[C]: ?
[C]: in function ‘start’
…onehearth/services/server/tasks/run_task_action.luac:56: in function <…onehearth/services/server/tasks/run_task_action.luac:53>
[C]: ?

[C]: ?
[C]: in function 'start’
stonehearth/services/server/ai/compound_action.luac:125: in function <stonehearth/services/server/ai/compound_action.luac:122>
[C]: ?
[C]: in function 'run’
stonehearth/components/ai/ai_component.luac:186: in function '_thread_main’
stonehearth/services/server/threads/thread.luac:90: in function <stonehearth/services/server/threads/thread.luac:89>
[C]: in function 'xpcall’
stonehearth/services/server/threads/thread.luac:89: in function 'f’
radiant/lib/env.luac:8: in function <radiant/lib/env.luac:8>

I’ve already seen that bug in one post : the player created a 1X1 stockpile and then deleted it. Then came the error. Let me find this post to check if this is the same bug :wink:

I just now deleted a 20X20 storage on the dirt and didn’t get the error.

I’ve found it : here it is (same post because moved)
Indeed this is the same bug :slightly_smiling:

Thank you for looking for the post.

He said the bug occured when he deleted a 1X1 stockpile but wasn’t able to reproduce it.
If at any moment you encounter this bug again, please report it :smile:

Okay, thank you I was wondering if I did wrong in reporting it, sense it was already reported.

The stockpile was was 6X ?. My hand jerked when I was making it which caused me to click before I wanted to.

Nope you did right. If only one post reports a bug, that means that bug is rare and doesn’t need to be solved quickly.
So your stockpile was more than 1X1 ?

Yes, it was at least 6 across with maybe 4 down or more but very small. I was trying to make 20X20 when my hand jerked so I wasn’t paying attention to the size that it made.

That may be linked with the one block of depth. I assume you tried again and didn’t trigger the bug did you ?
If you have a few minutes to lost, try to make several stockpiles of different sizes with 0 and 1 block of depth :wink:
Tell me if you have the time or not.

Okay I’ll go try that now. I’ll come back and let you know if I can repeat it.

ETA. Okay I deleted all stockpiles and tried 1X1, 1X2, 4X6 and a few other sizes but couldn’t get the error again. The only thing I didn’t do was delete my saves and go back to the main menu and start a new game without quitting which is what I had done before.

2 Likes

Okay no problem. This little bug is apparently trying to make fun of us.
I’ll just kick him out by calling our favourite @moderators.

1 Like

I wonder if it was my hand jerking when making the stockpile. When that happens I click more than one mouse button. I have arthritus (sp?) in my hands and on all the games I play that happens. I’ve died in some games when I tried to talk to someone but instead I shoot them when my hand jerks which turns them hostile.

1 Like