Could not send message '<unknown>' from 'game:<unknown>#<unknown>' to '<unknown>:<unknown>'

First of all - I’m sure this is somehow rooted in my code, but I’m not really sure what it means and why it’s happening:

Could not send message '<unknown>' from 'game:<unknown>#<unknown>' to '<unknown>:<unknown>'.

It doesn’t happen to me, but I have had it reported from my users. It’s happened both in Windows and Linux.

My biggest clue is that it seems to happen on a new game, and the message in question is from one collection proxy to another. Perhaps something to do with the collection proxies not being loaded? Not sure how that would be possible, because my setup is such that the collection proxy where the message originates (“game”) is loaded after the target collection proxy (“HUD”).

I had HUD set to “async_load” (with “enable” passed as soon as the collection is loaded), with the game not beginning to load until the “proxy_loaded” message was received. Could that be part of the issue? Would changing HUD to regular load make a difference?

Sorry for the vague question, it’s hard for me to troubleshoot this because I can’t reproduce it on my machine.

How does the problem manifest itself to the user? Does that message show up in a log somewhere?

You could monkey patch msg.post and add some additional log message before calling the real msg.post function to help you trace the code flow and where the message originates from and what happened prior to the error.

2 Likes

I’m not entirely sure how the issue manifests. I think it is linked to a failure to load a new map, because I have some reports of users saying they get just a black screen but sounds etc are still playing. Not very helpful, I know.

The message is extracted from error logs captured locally by Err / errors sent to me automatically via analytics.

As Björn mentions, you could try to monkey patch the msg.post function so you can inject your own diagnostics.

Something like this:

local msg_post = msg.post

msg.post = function(receiver, message_id, message)
	local ok, err = pcall(msg_post, receiver, message_id, message)
	if not ok then
		print("Unable to send message", message_id, " to ", receiver)
	end
end
2 Likes

Thanks for that. I will see about putting something like that in the offending scripts.

No, put it in one of the first scripts that you load in the entire project. The snippet of code I shared replaces the original functionality of msg.post. You want to do that once at the beginning of your project.

My bad. The “local” tag threw me. Won’t that make the redefined function only apply in the scope of the script I put this in? Maybe you just wrote the example quickly and it’s not supposed to be “local”, otherwise I am confused.

I’m storing the original and global msg.post in a local variable and then replacing the global function with my own custom function. The custom function adds error checking when it uses the now locally stored original function.

Hi! I apologize for bringing up an old topic but I’ve encountered the same error with players and can’t figure out what the problem is.

Could not send message '<unknown>' from 'story_collection:<unknown>#<unknown>' to '<unknown>:<unknown>'

I tried to insert the example monkey patch from britzl, but then the game stops loading at the very beginning and gives the following errors:

Unable to send message	enable	 to 	url: [base_collection:/base#proxy_handler]
DEBUG:SCRIPT: Unable to send message	acquire_input_focus	 to 	.
Unable to send message	enable	 to 	url: [handler_collection:/proxies#loader_screen]
DEBUG:SCRIPT: Unable to send message	hash: [release_input_focus]	 to 	.

@Alex_8BitSkull , if it’s not too much trouble, could you please tell me what your problem was back then? It might help me a lot.

The reason it says “unknown”, is that it’s a release build. Have you tried running a debug build instead? That way it would print the actual names and it would be easier to reason about.

2 Likes

Sorry, I don’t really remember the particulars of this as it was so long ago!

Sounds like this is a clue though? The monkey patched function is giving you information about which messages are not working. Maybe something to do with collection proxies not finished loading yet?

2 Likes

Thanks for the advice! I made an update in the debug version, but the error remains the same, apparently if the application is based on the release version, then using liveupdate can’t make the debug version and I need to release the debug version via store?

I have a traceback error and it happens in this location, but only in a small amount of players:

for i = 1, #story_info.wardrobe do
	msg.post(story_info.wardrobe[i].proxy.."_collection:/"..story_info.wardrobe[i].object, "hide_sprite")
end

Is there any way to determine what the problem might be? Maybe make a temporary timer.delay to give the collections time to load and if the error is eliminated, then we need to look for why the loading starts before everything loads?

This is strange because without the monkey patch, downloading the collections mentioned in the error below works fine. The error appears for players only after loading a “level”.

I also think that somehow the collection proxy has not had time to load. I double-checked the code and the loading should start only after I get “proxy_loaded” from all necessary collections. But how to check specifically in the place where the error occurs, whether all collections are loaded, I have no idea yet.

Hard to say without looking at your code, but shouldn’t you be able to track the state of each collection you have. Put the collections in a Lua table as keys and associate their current status as their value (not loaded, loading, loaded etc)

2 Likes

Thanks, I’ll try to take your advice and make a lua table with collections and track status through it.