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

**URL:** <https://forum.defold.com/t/could-not-send-message-unknown-from-game-unknown-unknown-to-unknown-unknown/64789>\
**Category:** Bugs\
**Created:** [April 2, 2020, 10:23am UTC](https://forum.defold.com/t/could-not-send-message-unknown-from-game-unknown-unknown-to-unknown-unknown/64789 "2020-04-02T10:23:24Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_8BitSkull](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/alex_8bitskull/32/5424_2.png) [@Alex\_8BitSkull](https://forum.defold.com/u/Alex_8BitSkull)\
**Post date:** [April 2, 2020, 10:23am UTC](https://forum.defold.com/t/could-not-send-message-unknown-from-game-unknown-unknown-to-unknown-unknown/64789/1 "2020-04-02T10:23:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [April 3, 2020, 4:07am UTC](https://forum.defold.com/t/could-not-send-message-unknown-from-game-unknown-unknown-to-unknown-unknown/64789/2 "2020-04-03T04:07:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Alex\_8BitSkull](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/alex_8bitskull/32/5424_2.png) [@Alex\_8BitSkull](https://forum.defold.com/u/Alex_8BitSkull)\
**Post date:** [April 3, 2020, 7:31am UTC](https://forum.defold.com/t/could-not-send-message-unknown-from-game-unknown-unknown-to-unknown-unknown/64789/3 "2020-04-03T07:31:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [April 3, 2020, 11:14am UTC](https://forum.defold.com/t/could-not-send-message-unknown-from-game-unknown-unknown-to-unknown-unknown/64789/4 "2020-04-03T11:14:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [April 3, 2020, 4:53pm UTC](https://forum.defold.com/t/could-not-send-message-unknown-from-game-unknown-unknown-to-unknown-unknown/64789/5 "2020-04-03T16:53:40Z")

</div>

> [@Mathias\_Westerdahl](#):
>
> 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

```

---

<div class="post-metadata">

**Author:** ![Alex\_8BitSkull](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/alex_8bitskull/32/5424_2.png) [@Alex\_8BitSkull](https://forum.defold.com/u/Alex_8BitSkull)\
**Post date:** [April 3, 2020, 6:25pm UTC](https://forum.defold.com/t/could-not-send-message-unknown-from-game-unknown-unknown-to-unknown-unknown/64789/6 "2020-04-03T18:25:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [April 4, 2020, 5:23am UTC](https://forum.defold.com/t/could-not-send-message-unknown-from-game-unknown-unknown-to-unknown-unknown/64789/7 "2020-04-04T05:23:15Z")

</div>

> [@Alex\_8BitSkull](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![Alex\_8BitSkull](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/alex_8bitskull/32/5424_2.png) [@Alex\_8BitSkull](https://forum.defold.com/u/Alex_8BitSkull)\
**Post date:** [April 4, 2020, 7:14am UTC](https://forum.defold.com/t/could-not-send-message-unknown-from-game-unknown-unknown-to-unknown-unknown/64789/8 "2020-04-04T07:14:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [April 4, 2020, 10:18am UTC](https://forum.defold.com/t/could-not-send-message-unknown-from-game-unknown-unknown-to-unknown-unknown/64789/9 "2020-04-04T10:18:18Z")

</div>

> [@Alex\_8BitSkull](#):
>
> The “local” tag threw me

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.

---

<div class="post-metadata">

**Author:** ![Max\_R](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/max_r/32/30651_2.png) [@Max\_R](https://forum.defold.com/u/Max_R)\
**Post date:** [April 26, 2024, 6:55am UTC](https://forum.defold.com/t/could-not-send-message-unknown-from-game-unknown-unknown-to-unknown-unknown/64789/10 "2024-04-26T06:55:18Z")

</div>

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.

```lua
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:

```lua
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.

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [April 26, 2024, 7:08am UTC](https://forum.defold.com/t/could-not-send-message-unknown-from-game-unknown-unknown-to-unknown-unknown/64789/11 "2024-04-26T07:08:59Z")

</div>

> [@Max\_R](#):
>
> ```lua
> Could not send message '<unknown>' from 'story_collection:<unknown>#<unknown>' to '<unknown>:<unknown>'
> 
> ```

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.

---

<div class="post-metadata">

**Author:** ![Alex\_8BitSkull](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/alex_8bitskull/32/5424_2.png) [@Alex\_8BitSkull](https://forum.defold.com/u/Alex_8BitSkull)\
**Post date:** [April 26, 2024, 8:24am UTC](https://forum.defold.com/t/could-not-send-message-unknown-from-game-unknown-unknown-to-unknown-unknown/64789/12 "2024-04-26T08:24:04Z")

</div>

> [@Max\_R](#):
>
> @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.

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

> [@Max\_R](#):
>
> 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:
> 
> ```lua
> 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] t
> 
> ```

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?

---

<div class="post-metadata">

**Author:** ![Max\_R](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/max_r/32/30651_2.png) [@Max\_R](https://forum.defold.com/u/Max_R)\
**Post date:** [April 26, 2024, 12:36pm UTC](https://forum.defold.com/t/could-not-send-message-unknown-from-game-unknown-unknown-to-unknown-unknown/64789/13 "2024-04-26T12:36:11Z")

</div>

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:

```lua
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?

---

<div class="post-metadata">

**Author:** ![Max\_R](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/max_r/32/30651_2.png) [@Max\_R](https://forum.defold.com/u/Max_R)\
**Post date:** [April 26, 2024, 12:49pm UTC](https://forum.defold.com/t/could-not-send-message-unknown-from-game-unknown-unknown-to-unknown-unknown/64789/14 "2024-04-26T12:49:20Z")

</div>

> [@Alex\_8BitSkull](#):
>
> 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?

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.

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [April 26, 2024, 2:21pm UTC](https://forum.defold.com/t/could-not-send-message-unknown-from-game-unknown-unknown-to-unknown-unknown/64789/15 "2024-04-26T14:21:35Z")

</div>

> [@Max\_R](#):
>
> 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)

---

<div class="post-metadata">

**Author:** ![Max\_R](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/max_r/32/30651_2.png) [@Max\_R](https://forum.defold.com/u/Max_R)\
**Post date:** [April 26, 2024, 3:13pm UTC](https://forum.defold.com/t/could-not-send-message-unknown-from-game-unknown-unknown-to-unknown-unknown/64789/16 "2024-04-26T15:13:53Z")

</div>

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