<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Uncaught Error: ChangeTree: missing index for field &quot;undefined&quot;]]></title><description><![CDATA[<p>Hello everyone,</p>
<p>I'm currently building a web game (based on colyseus and VueJS).</p>
<p>I had no problem at all during the whole development, but today I just saw this error pop in the console at a specific moment.<br />
<a href="https://postimg.cc/563C0y5C" rel="nofollow"><img src="https://i.postimg.cc/Gm0JXsHq/error-colyseus.png" alt="error-colyseus.png" class="img-responsive img-markdown" /></a><br />
It does not block the code and execution.<br />
It is due to this line of code, <strong>server-side</strong>, in a listener for client request</p>
<pre><code>this.state.players.get(client.sessionId).jokers.get(packet.datas).available = false;
</code></pre>
<p>I have tried to write it that way but the error is still here</p>
<pre><code>let player = this.state.players.get(client.sessionId);
let joker = player.jokers.get(packet.datas);
joker.available = false;
</code></pre>
<p>the property jokers is a mapSchema binded with jokers &quot;slug&quot; so it's easy to find them.</p>
<p>Why is it causing an error and do you have a tip to avoid it ?</p>
<p>Thanks !<br />
Maël</p>
]]></description><link>http://discuss.colyseus.io/topic/474/uncaught-error-changetree-missing-index-for-field-undefined</link><generator>RSS for Node</generator><lastBuildDate>Sun, 19 Jul 2026 18:20:43 GMT</lastBuildDate><atom:link href="http://discuss.colyseus.io/topic/474.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 16 Jun 2021 15:35:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Uncaught Error: ChangeTree: missing index for field &quot;undefined&quot; on Invalid Date]]></title><description><![CDATA[<p>Hello everyone,</p>
<p>I'm currently building a web game (based on colyseus and VueJS).</p>
<p>I had no problem at all during the whole development, but today I just saw this error pop in the console at a specific moment.<br />
<a href="https://postimg.cc/563C0y5C" rel="nofollow"><img src="https://i.postimg.cc/Gm0JXsHq/error-colyseus.png" alt="error-colyseus.png" class="img-responsive img-markdown" /></a><br />
It does not block the code and execution.<br />
It is due to this line of code, <strong>server-side</strong>, in a listener for client request</p>
<pre><code>this.state.players.get(client.sessionId).jokers.get(packet.datas).available = false;
</code></pre>
<p>I have tried to write it that way but the error is still here</p>
<pre><code>let player = this.state.players.get(client.sessionId);
let joker = player.jokers.get(packet.datas);
joker.available = false;
</code></pre>
<p>the property jokers is a mapSchema binded with jokers &quot;slug&quot; so it's easy to find them.</p>
<p>Why is it causing an error and do you have a tip to avoid it ?</p>
<p>Thanks !<br />
Maël</p>
]]></description><link>http://discuss.colyseus.io/post/1525</link><guid isPermaLink="true">http://discuss.colyseus.io/post/1525</guid><dc:creator><![CDATA[atzmael]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Uncaught Error: ChangeTree: missing index for field &quot;undefined&quot; on Invalid Date]]></title><description><![CDATA[<p>Hi Maël, welcome! 👋</p>
<p>Are you using <code>@filter()</code> or <code>@filterChildren()</code>?</p>
<p>Can you please share your source-code with us, so we can have a bigger picture of the operations on MapSchema? I'm curious to see what's going on as I've never seen this error before!</p>
<p>Feel free to ping me on Discord (endel#2163) or email (endel[at]<a href="http://lucidsight.com" rel="nofollow">lucidsight.com</a>)</p>
<p>Cheers!</p>
]]></description><link>http://discuss.colyseus.io/post/1526</link><guid isPermaLink="true">http://discuss.colyseus.io/post/1526</guid><dc:creator><![CDATA[endel]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Uncaught Error: ChangeTree: missing index for field &quot;undefined&quot; on Invalid Date]]></title><description><![CDATA[<p>Hi <a class="plugin-mentions-user plugin-mentions-a" href="http://discuss.colyseus.io/uid/1">@endel</a> ! Thanks</p>
<p>thank for answering, I'm not using <code>@filter()</code> or <code>@filterChildren()</code>.</p>
<p>Here is the code of the MapSchema :</p>
<pre><code>export class Joker extends Schema {
    @type(&quot;string&quot;)
    type: string;

    @type(&quot;string&quot;)
    slug: string;

    @type(&quot;string&quot;)
    name: string;

    @type(&quot;boolean&quot;)
    available: boolean = true;

    @type(&quot;boolean&quot;)
    isUsed: boolean = false;
}
</code></pre>
<p>and it's inplementation in the Schema for the Player</p>
<pre><code>@type({ map: Joker })
jokers: MapSchema&lt;Joker&gt;;
</code></pre>
<p>I initialize it here (maybe here is the bad code haha) :</p>
<pre><code>let jokers = new MapSchema&lt;Joker&gt;();
    this.jokers.forEach((jk) =&gt; {
        let joker = new Joker({
        type: jk.type,
        slug: jk.slug,
        name: jk.name,
        available: true,
        isUsed: false
    });
    jokers.set(jk.slug, joker);
})
</code></pre>
<p>the jokers array</p>
<pre><code>jokers = [
        { type: 'bonus', slug: &quot;cdp&quot;, name: &quot;Coup d'pouce&quot; },
        { type: 'attaque', slug: &quot;pjn&quot;, name: &quot;Petit jaune&quot; },
    ];
</code></pre>
<p>And the error throws when I do this :<br />
<code>this.state.players.get(client.sessionId).jokers.get(packet.datas).available = false;</code></p>
<p>Just to know, I use <code>this.state.players.get(client.sessionId).jokers.get(packet.datas).available</code> in a <code>if</code> right before and it doesn't throw error.<br />
Plus, the error is throwing on client-side in colyseus.js and nothing shows up on server-side.</p>
<p>Hope it will help !</p>
<p>Cheers!</p>
]]></description><link>http://discuss.colyseus.io/post/1528</link><guid isPermaLink="true">http://discuss.colyseus.io/post/1528</guid><dc:creator><![CDATA[atzmael]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Uncaught Error: ChangeTree: missing index for field &quot;undefined&quot; on Fri, 17 Sep 2021 22:06:16 GMT]]></title><description><![CDATA[<p>Hello 👋  <a class="plugin-mentions-user plugin-mentions-a" href="http://discuss.colyseus.io/uid/819">@atzmael</a> did you have any luck figuring this out? I, too, currently get this error every once in a while but only client-side 🤔</p>
<p>I get this stacktrace btw.:</p>
<pre><code>Uncaught Error: ChangeTree: missing index for field &quot;undefined&quot;
    at e.assertValidIndex (index.js:388)
    at e.touch (index.js:268)
    at e.touchParents (index.js:278)
    at e.change (index.js:264)
    at e.set [as x] (index.js:1308)
    at e.decode (index.js:2570)
    at t.patch (NoneSerializer.ts:7)
    at e.patch (Room.ts:267)
    at e.onMessageCallback (Room.ts:252)
</code></pre>
]]></description><link>http://discuss.colyseus.io/post/1580</link><guid isPermaLink="true">http://discuss.colyseus.io/post/1580</guid><dc:creator><![CDATA[hatala91]]></dc:creator><pubDate>Fri, 17 Sep 2021 22:06:16 GMT</pubDate></item></channel></rss>