# Collection Proxy problems

**URL:** <https://forum.defold.com/t/collection-proxy-problems/67226>\
**Category:** Questions\
**Created:** [January 9, 2021, 7:35pm UTC](https://forum.defold.com/t/collection-proxy-problems/67226 "2021-01-09T19:35:35Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZaTimou](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/zatimou/32/41758_2.png) [@ZaTimou](https://forum.defold.com/u/ZaTimou)\
**Post date:** [January 9, 2021, 7:35pm UTC](https://forum.defold.com/t/collection-proxy-problems/67226/1 "2021-01-09T19:35:35Z")

</div>

So I’m trying to load a proxy (“`debug`”). However, I get

```lua
ERROR:GAMEOBJECT: The collection 'debug' could not be created since there is already a socket with the same name.
ERROR:GAMEOBJECT: AcquireResources NewCollection RESULT_OUT_OF_RESOURCES
WARNING:RESOURCE: Unable to create resource: /areas/test_place/debug.collectionc: OUT_OF_RESOURCES
ERROR:GAMESYS: The collection /areas/test_place/debug.collectionc could not be loaded.

```

I don’t know what’s wrong, I’ve checked every collection I have and none of them have the same name.  
Someone look at this, please?

Thank you~

---

<div class="post-metadata">

**Author:** ![Dat\_Indie](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/dat_indie/32/18548_2.png) [@Dat\_Indie](https://forum.defold.com/u/Dat_Indie)\
**Post date:** [January 9, 2021, 8:41pm UTC](https://forum.defold.com/t/collection-proxy-problems/67226/2 "2021-01-09T20:41:06Z")

</div>

Hey there.  
Check your collection’s name properties.

 ![Screenshot%202021-01-09%20173904](https://forum-defold.b-cdn.net/uploads/default/original/3X/f/2/f298ee1390cbc238e7265fd295b83e3a97769d7d.png)

---

<div class="post-metadata">

**Author:** ![ZaTimou](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/zatimou/32/41758_2.png) [@ZaTimou](https://forum.defold.com/u/ZaTimou)\
**Post date:** [January 9, 2021, 11:03pm UTC](https://forum.defold.com/t/collection-proxy-problems/67226/3 "2021-01-09T23:03:24Z")

</div>

Emm… That’s what I was talking about?  
All of them had different names, and I even tried changing them under properties…

---

<div class="post-metadata">

**Author:** ![Potota](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/potota/32/33404_2.png) [@Potota](https://forum.defold.com/u/Potota)\
**Post date:** [January 9, 2021, 11:10pm UTC](https://forum.defold.com/t/collection-proxy-problems/67226/4 "2021-01-09T23:10:37Z")

</div>

Then that means you loaded `debug` twice.

---

<div class="post-metadata">

**Author:** ![ZaTimou](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/zatimou/32/41758_2.png) [@ZaTimou](https://forum.defold.com/u/ZaTimou)\
**Post date:** [January 9, 2021, 11:32pm UTC](https://forum.defold.com/t/collection-proxy-problems/67226/5 "2021-01-09T23:32:46Z")

</div>

Oh.  
So basically I have to go though all of my code to look for where I loaded it twice?

---

<div class="post-metadata">

**Author:** ![Potota](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/potota/32/33404_2.png) [@Potota](https://forum.defold.com/u/Potota)\
**Post date:** [January 9, 2021, 11:34pm UTC](https://forum.defold.com/t/collection-proxy-problems/67226/6 "2021-01-09T23:34:23Z")

</div>

Well, not _all_ of your code. But yes, you need to look for where it gets loaded twice.

---

<div class="post-metadata">

**Author:** ![ZaTimou](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/zatimou/32/41758_2.png) [@ZaTimou](https://forum.defold.com/u/ZaTimou)\
**Post date:** [January 9, 2021, 11:53pm UTC](https://forum.defold.com/t/collection-proxy-problems/67226/7 "2021-01-09T23:53:08Z")

</div>

```lua
DEBUG:SCRIPT: debug2
WARNING:GAMEOBJECT: Instance is initialized twice, this may lead to undefined behaviour.
Assertion failed: !component->m_AddedToUpdate, file ..\src\gamesys\components\comp_collision_object.cpp, line 832

```

D:  
I guess I’ll have to look for where it init twice…  
Also, where is

```lua
..\src\gamesys\components\comp_collision_object.cpp, line 832

```

anyway?  
I think it’d be helpful in trying to fix this. : /

---

<div class="post-metadata">

**Author:** ![Potota](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/potota/32/33404_2.png) [@Potota](https://forum.defold.com/u/Potota)\
**Post date:** [January 9, 2021, 11:56pm UTC](https://forum.defold.com/t/collection-proxy-problems/67226/8 "2021-01-09T23:56:16Z")

</div>

> [@ZaTimou](#):
>
> Also, where is
> 
> ```lua
> ..\src\gamesys\components\comp_collision_object.cpp, line 832
> 
> ```
> 
> anyway?

That would be [here](https://github.com/defold/defold/blob/86b6914c675a5813025e1f9f828f9be53911c6ce/engine/gamesys/src/gamesys/components/comp_collision_object.cpp#L832) in the engine source code. You shouldn’t need it to fix a problem in your code.

---

<div class="post-metadata">

**Author:** ![ZaTimou](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/zatimou/32/41758_2.png) [@ZaTimou](https://forum.defold.com/u/ZaTimou)\
**Post date:** [January 9, 2021, 11:57pm UTC](https://forum.defold.com/t/collection-proxy-problems/67226/9 "2021-01-09T23:57:16Z")

</div>

Oh.  
Well, good to know anyway, I guess~  
Thanks~

---

<div class="post-metadata">

**Author:** ![ZaTimou](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/zatimou/32/41758_2.png) [@ZaTimou](https://forum.defold.com/u/ZaTimou)\
**Post date:** [January 14, 2021, 4:58pm UTC](https://forum.defold.com/t/collection-proxy-problems/67226/10 "2021-01-14T16:58:35Z")

</div>

Alright, I’ve been looking for a while and I can’t seem to find where the problem is (maybe because I’m not looking in the right places?)

Is there anyone who can help me look for where the double-init might be? (I can send you my project if you give me your email) Or maybe give me some advice on where to look properly?

---

<div class="post-metadata">

**Author:** ![Potota](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/potota/32/33404_2.png) [@Potota](https://forum.defold.com/u/Potota)\
**Post date:** [January 14, 2021, 5:30pm UTC](https://forum.defold.com/t/collection-proxy-problems/67226/11 "2021-01-14T17:30:58Z")

</div>

Send it to me ([justapotota.dev@gmail.com](mailto:justapotota.dev@gmail.com)) and I’ll take a look.

---

<div class="post-metadata">

**Author:** ![Potota](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/potota/32/33404_2.png) [@Potota](https://forum.defold.com/u/Potota)\
**Post date:** [January 14, 2021, 8:32pm UTC](https://forum.defold.com/t/collection-proxy-problems/67226/12 "2021-01-14T20:32:32Z")

</div>

The problem was in `/overworld/overworlds.script`. I’m still not sure what exactly caused the error, but just cleaning up the script seems to have fixed it.

> **Original**
>
> ```lua
> function init(self)
> local rendercam = require "rendercam.rendercam"
> end
> 
> local curarea = "notexist"
> local newcurarea = ""
> 
> function on_message(self, message_id, message, sender)
> if message_id == hash("load_area") then
> msg.post("#"..curarea, "disable")
> msg.post("#"..curarea, "unload")
> msg.post("#"..message.new_area, "load")
> msg.post("#"..message.new_area, "enable")
> curarea = message.new_area
> area = message.new_area
> print(curarea)
> end
> if message_id == hash("load_area2") then
> msg.post("#"..curarea, "disable")
> msg.post("#"..curarea, "unload")
> msg.post("#"..message.new_area, "load")
> msg.post("#"..message.new_area, "init")
> curarea = message.new_area
> area = message.new_area
> print(curarea)
> end
> end
> 
> ```

> **Fixed**
>
> ```lua
> local rendercam = require "rendercam.rendercam"
> 
> -- This sets curarea to nil
> local curarea
> local newcurarea = ""
> 
> function on_message(self, message_id, message, sender)
> if message_id == hash("load_area") or message_id == hash("load_area2") then
> -- 'if curarea then' is the same as 'if curarea ~= nil then'
> if curarea then
> msg.post("#"..curarea, "disable")
> msg.post("#"..curarea, "final")
> msg.post("#"..curarea, "unload")
> end
> msg.post("#"..message.new_area, "load")
> print("Loading area '" .. message.new_area .. "'")
> 		
> curarea = message.new_area
> elseif message_id == hash("proxy_loaded") then
> msg.post(sender, "enable")
> end
> end
> 
> ```

P.S. You should take the time to go through your project and do some cleanup while it’s still relatively small. It really does make everything so much easier down the line.
