<?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[Error in engine_processor spawning creep after setting custom terrain]]></title><description><![CDATA[<p>Here's the error I'm getting, in engine_processor1.log. The server <em>is </em>ticking, but no creeps are spawning (from my single spawn).</p>
<p>```</p>
<p>Error processing room W6N6: TypeError: terrain.charAt is not a function<br>    at Object.exports.checkTerrain (/home/ocean/server/modules/engine/dist/utils.js:320:88)<br>    at module.exports (/home/ocean/server/modules/engine/dist/processor/intents/spawns/_born-creep.js:28:67)<br>    at module.exports (/home/ocean/server/modules/engine/dist/processor/intents/spawns/tick.js:19:50)<br>    at /home/ocean/server/modules/engine/dist/processor.js:239:83<br>    at /home/ocean/server/modules/engine/node_modules/lodash/index.js:3073:15<br>    at baseForOwn (/home/ocean/server/modules/engine/node_modules/lodash/index.js:2046:14)<br>    at /home/ocean/server/modules/engine/node_modules/lodash/index.js:3043:18<br>    at Function.&lt;anonymous&gt; (/home/ocean/server/modules/engine/node_modules/lodash/index.js:3346:13)<br>    at /home/ocean/server/modules/engine/dist/processor.js:229:11<br>    at _fulfilled (/home/ocean/server/modules/engine/node_modules/q/q.js:834:54)</p>
<p>```</p>
<p><br>This error occurs every tick.</p>
<p> </p>
<p>I set up this server by copying the server files over from the steam directory to a dedicated VPS. I reset all data, then ran `map.closeRoom()` on all rooms, then `map.generateRoom(..., exits: {(all sides): [1, 2, 3, 46, 47, 48], sources: 4` on the center 9 rooms. I spawned in W6N6.</p>
<p> </p>
<p>I was also getting this error occasionally - but it seems to have gone away with a fresh build of version 31. </p>
<p>```</p>
<p>Unhandled rejection: SyntaxError: Unexpected token u in JSON at position 0<br>    at Object.parse (native)<br>    at env.get.then.data (/home/ocean/server/modules/driver/lib/history.js:16:35)<br>    at _fulfilled (/home/ocean/server/modules/common/node_modules/q/q.js:834:54)<br>    at self.promiseDispatch.done (/home/ocean/server/modules/common/node_modules/q/q.js:863:30)<br>    at Promise.promise.promiseDispatch (/home/ocean/server/modules/common/node_modules/q/q.js:796:13)<br>    at /home/ocean/server/modules/common/node_modules/q/q.js:604:44<br>    at runSingle (/home/ocean/server/modules/common/node_modules/q/q.js:137:13)<br>    at flush (/home/ocean/server/modules/common/node_modules/q/q.js:125:13)<br>    at _combinedTickCallback (internal/process/next_tick.js:67:7)<br>    at process._tickCallback (internal/process/next_tick.js:98:9)</p>
<p>```</p>
<p> </p>
<p>For anyone else running into this: there's a very-temporary very-hacky hack to fix this posted below.</p>]]></description><link>http://screeps.com/forum/topic/490/error-in-engine_processor-spawning-creep-after-setting-custom-terrain</link><generator>RSS for Node</generator><lastBuildDate>Mon, 07 Sep 2026 03:49:26 GMT</lastBuildDate><atom:link href="http://screeps.com/forum/topic/490.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 04 Nov 2016 08:19:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Error in engine_processor spawning creep after setting custom terrain on Invalid Date]]></title><description><![CDATA[<p>Here's the error I'm getting, in engine_processor1.log. The server <em>is </em>ticking, but no creeps are spawning (from my single spawn).</p>
<p>```</p>
<p>Error processing room W6N6: TypeError: terrain.charAt is not a function<br>    at Object.exports.checkTerrain (/home/ocean/server/modules/engine/dist/utils.js:320:88)<br>    at module.exports (/home/ocean/server/modules/engine/dist/processor/intents/spawns/_born-creep.js:28:67)<br>    at module.exports (/home/ocean/server/modules/engine/dist/processor/intents/spawns/tick.js:19:50)<br>    at /home/ocean/server/modules/engine/dist/processor.js:239:83<br>    at /home/ocean/server/modules/engine/node_modules/lodash/index.js:3073:15<br>    at baseForOwn (/home/ocean/server/modules/engine/node_modules/lodash/index.js:2046:14)<br>    at /home/ocean/server/modules/engine/node_modules/lodash/index.js:3043:18<br>    at Function.&lt;anonymous&gt; (/home/ocean/server/modules/engine/node_modules/lodash/index.js:3346:13)<br>    at /home/ocean/server/modules/engine/dist/processor.js:229:11<br>    at _fulfilled (/home/ocean/server/modules/engine/node_modules/q/q.js:834:54)</p>
<p>```</p>
<p><br>This error occurs every tick.</p>
<p> </p>
<p>I set up this server by copying the server files over from the steam directory to a dedicated VPS. I reset all data, then ran `map.closeRoom()` on all rooms, then `map.generateRoom(..., exits: {(all sides): [1, 2, 3, 46, 47, 48], sources: 4` on the center 9 rooms. I spawned in W6N6.</p>
<p> </p>
<p>I was also getting this error occasionally - but it seems to have gone away with a fresh build of version 31. </p>
<p>```</p>
<p>Unhandled rejection: SyntaxError: Unexpected token u in JSON at position 0<br>    at Object.parse (native)<br>    at env.get.then.data (/home/ocean/server/modules/driver/lib/history.js:16:35)<br>    at _fulfilled (/home/ocean/server/modules/common/node_modules/q/q.js:834:54)<br>    at self.promiseDispatch.done (/home/ocean/server/modules/common/node_modules/q/q.js:863:30)<br>    at Promise.promise.promiseDispatch (/home/ocean/server/modules/common/node_modules/q/q.js:796:13)<br>    at /home/ocean/server/modules/common/node_modules/q/q.js:604:44<br>    at runSingle (/home/ocean/server/modules/common/node_modules/q/q.js:137:13)<br>    at flush (/home/ocean/server/modules/common/node_modules/q/q.js:125:13)<br>    at _combinedTickCallback (internal/process/next_tick.js:67:7)<br>    at process._tickCallback (internal/process/next_tick.js:98:9)</p>
<p>```</p>
<p> </p>
<p>For anyone else running into this: there's a very-temporary very-hacky hack to fix this posted below.</p>]]></description><link>http://screeps.com/forum/post/2361</link><guid isPermaLink="true">http://screeps.com/forum/post/2361</guid><dc:creator><![CDATA[daboross]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Error in engine_processor spawning creep after setting custom terrain on Invalid Date]]></title><description><![CDATA[<p> It seems like what's being passed into `checkTerrain` isn't a string, but rather an object? This is what I get when I catch the error, and print `terrain` at line 16 of `modules/driver/lib/history.js`:</p>
<p> </p>
<p>```</p>
<p>{"b36ee575fe89ebe":{"room":"W4N4","terrain":"1000111111111111111111111111111111111111111111000100000111111111111111111111111111111111111111102200000000000000000111111111111111111111111111110022200000000000000200011111111111111111111111111000020010000000000000000001111111111111111111111100000001110000000000000000000111111111111111111110000000111110000000000000000000013311111111111111000000011111100000000000000000000023111111111111100200000111111000000000000000000000221111112000000002200001111110020000000000000000000011110000000000000000011111100000000000000000000000111000020002201100000111111000000000000000000000000000000000022211000001111111000000000000000000000000000000000002000000011111110000000002000000000000000000000000000000000111111110000000000000000000000000000000000000000021111111100000000000000000000000000000200000000000011111111100000000000000000000000000000000000000000111111111000000000000000000000000000000000000000001111111110000001111000000000000000000000000000000011111111100002111110000000000000000000000000000000111111111000001111000000000000000000000000000000001111111110000011100000000000000000000020000000000011111111100000000000000000000000000000002000000000111111111000000000000000000200000000000020000000001111111110000000000000000022200000000000200000000011111111100000000000000000000000000000000000000000111111111020000000000000000000000000000000000000001111111110000000000000000000000000000000000000000011111111100000001100000000002220000000000000000000111111111000000111002000000000000000000000000000001111111110000011100020000000000000000000000000000011111111100000110000200000000000001110000200000000111111111000000000000020000000000111110000000000001111111110000000000000000000000001111100000111000011111111100000000000000000000000000000022001110000111111111220000000000000022000000000000000001000001111111112200000000000000000000000000000000000000011111111100000000000000000000000000000000000000000111111111000000000000000000000000000000000000000001111111110000000020000000000000000000000000000002211111111100000000000000000000000000200000000000220111111110000000000000000000111111113311110000000001111111000000000000000000001111111111111110000220011111100000000000000000000111111111111111110000000111110000000000002222220001111111111111111110000020111000000000000002222200111111111111111111110000000100000000000000000000111111111111111111111110000000000000000000000000111111111111111111111111110000000000111111111111111111111111111111111111111110000010001111111111111111111111111111111111111111110001","_id":"b36ee575fe89ebe","meta":{"revision":0,"created":1478246227944,"version":0},"$loki":145}}</p>
<p>```</p>
<p> </p>
<p>I don't know entirely what to make of this - could this information help determine if this is a bug or user error?</p>]]></description><link>http://screeps.com/forum/post/2362</link><guid isPermaLink="true">http://screeps.com/forum/post/2362</guid><dc:creator><![CDATA[daboross]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Error in engine_processor spawning creep after setting custom terrain on Invalid Date]]></title><description><![CDATA[<p>Could you please attach your <code>db.json</code> file?</p>]]></description><link>http://screeps.com/forum/post/2363</link><guid isPermaLink="true">http://screeps.com/forum/post/2363</guid><dc:creator><![CDATA[artch]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Error in engine_processor spawning creep after setting custom terrain on Invalid Date]]></title><description><![CDATA[<p>I can't seem to upload a file directly to this chat. However, here's a dropbox link for the DB.json: --</p>
<p>EDIT: link removed, updated db.json in comment below.</p>]]></description><link>http://screeps.com/forum/post/2364</link><guid isPermaLink="true">http://screeps.com/forum/post/2364</guid><dc:creator><![CDATA[daboross]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Error in engine_processor spawning creep after setting custom terrain on Invalid Date]]></title><description><![CDATA[<p>If I edit `modules/engine/dist/processor.js` like the following, it prevents the first `terrain.charAt` error, but does not prevent the second one:</p>
<p> </p>
<p>```</p>
<p>diff --git a/modules/engine/dist/processor.js b/modules/engine/dist/processor-edited.js<br>index 4db00cb..deda481 100755<br>--- a/modules/engine/dist/processor.js<br>+++ b/modules/engine/dist/processor-edited.js<br>@@ -32,7 +32,7 @@ function processRoom(roomId, intents, objects, terrain, gameTime, roomInfo, flag<br>         roomInfo.active = false;<br> <br>         var terrainItem = terrain[_.findKey(terrain)];<br>-        if (terrainItem.type == 'terrain') {<br>+        if (terrainItem.type == 'terrain' || (!terrainItem.type &amp;&amp; terrainItem.terrain)) {<br>             terrain = terrainItem.terrain;<br>         }</p>
<p>```</p>
<p> </p>
<p>I just made this change as a debugging effort - with it, creeps do spawn, but pathfinding still does not work, and the second error persists. (all PathFinder.search() calls return an incomplete, empty path).</p>]]></description><link>http://screeps.com/forum/post/2365</link><guid isPermaLink="true">http://screeps.com/forum/post/2365</guid><dc:creator><![CDATA[daboross]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Error in engine_processor spawning creep after setting custom terrain on Invalid Date]]></title><description><![CDATA[<p>Testing more with the game client, it seems that `Game.map.getTerrainAt()` returns "wall" for all positions.</p>]]></description><link>http://screeps.com/forum/post/2366</link><guid isPermaLink="true">http://screeps.com/forum/post/2366</guid><dc:creator><![CDATA[daboross]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Error in engine_processor spawning creep after setting custom terrain on Invalid Date]]></title><description><![CDATA[<p>I was testing all of this on Build 29 - I'm going to start a completely new server directory with Build 31 and see if it will still occur.</p>]]></description><link>http://screeps.com/forum/post/2367</link><guid isPermaLink="true">http://screeps.com/forum/post/2367</guid><dc:creator><![CDATA[daboross]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Error in engine_processor spawning creep after setting custom terrain on Invalid Date]]></title><description><![CDATA[<p>With a completely fresh, reset server version 31, the error does still occur. After closing all rooms, removing all rooms, regenerating all rooms, and respawning into one of them, I get a single error repeated ever tick in engine_processor1.log, as follows:</p>
<p> </p>
<p>Error processing room W1N1: TypeError: terrain.charAt is not a function<br>    at Object.exports.checkTerrain (/home/ocean/server/modules/engine/dist/utils.js:320:88)<br>    at module.exports (/home/ocean/server/modules/engine/dist/processor/intents/spawns/_born-creep.js:28:67)<br>    at module.exports (/home/ocean/server/modules/engine/dist/processor/intents/spawns/tick.js:19:50)<br>    at /home/ocean/server/modules/engine/dist/processor.js:239:83<br>    at /home/ocean/server/modules/engine/node_modules/lodash/index.js:3073:15<br>    at baseForOwn (/home/ocean/server/modules/engine/node_modules/lodash/index.js:2046:14)<br>    at /home/ocean/server/modules/engine/node_modules/lodash/index.js:3043:18<br>    at Function.&lt;anonymous&gt; (/home/ocean/server/modules/engine/node_modules/lodash/index.js:3346:13)<br>    at /home/ocean/server/modules/engine/dist/processor.js:229:11</p>
<p> </p>
<p> </p>
<p>A snapshot of the data for this reset server is available here: <a href="http://ocean.daboross.net/data/db.json" rel="nofollow noreferrer">http://ocean.daboross.net/data/db.json</a></p>
<p><br>I have not yet gotten the "Unexpected token u in JSON at position 0" error on this server, so that may have just been corrupted data? However, I do get the above error, after the complete reset and with doing nothing but regenerating all rooms.</p>
<p>To be clear, here's a list of steps I did to the fresh server in order to get to this error:<br><br>1. Use map.closeRoom(name).then(() =&gt; map.removeRoom(name)) on every room.</p>
<p>2. Use map.generateRoom(name).then(() =&gt; map.closeRoom(name)) on every room.</p>
<p>3. Use map.openRoom(name) on a 4x4 section of rooms.</p>
<p>4. Spawn into one of the newly opened rooms.</p>]]></description><link>http://screeps.com/forum/post/2368</link><guid isPermaLink="true">http://screeps.com/forum/post/2368</guid><dc:creator><![CDATA[daboross]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Error in engine_processor spawning creep after setting custom terrain on Invalid Date]]></title><description><![CDATA[<p>For anyone else who is running into this:</p>
<p>Through editing two of the server files, I seem to have been able to temporarily stop this error and fix pathfinding. I wouldn't recommend this as a permanent solution, as it is really quite a hack, but it did seem to work in my case:</p>
<p> </p>
<p>Patch 1, to fix the terrain.charAt is not a function error, and to allow creeps to spawn:</p>
<p>diff --git a/modules/engine/dist/processor-original.js b/modules/engine/dist/processor.js<br>index 9abd76b..84c2193 100755<br>--- a/modules/engine/dist/processor-original.js<br>+++ b/modules/engine/dist/processor.js<br>@@ -32,7 +32,7 @@ function processRoom(roomId, intents, objects, terrain, gameTime, roomInfo, flag<br>         roomInfo.active = false;<br> <br>         var terrainItem = terrain[_.findKey(terrain)];<br>-        if (terrainItem.type == 'terrain') {<br>+        if (terrainItem.type == 'terrain' || (terrainItem.type === undefined &amp;&amp; terrainItem.terrain !== undefined)) {<br>             terrain = terrainItem.terrain;<br>         }<br> </p>
<p>Patch 2, to fix pathfinding not working at all:</p>
<p> </p>
<p>diff --git a/modules/backend/lib/tools-original.js b/modules/backend/lib/tools.js<br>index a340124..21861b6 100755<br>--- a/modules/backend/lib/tools-original.js<br>+++ b/modules/backend/lib/tools.js<br>@@ -62,7 +62,7 @@ exports.updateTerrainData = function updateTerrainData() {<br> <br>             rooms.forEach(room =&gt; {<br>                 if(room.status == 'out of borders') {<br>-                    _.find(terrain, {room: room._id}).terrain = walled;<br>+                    // _.find(terrain, {room: room._id}).terrain = walled;<br>                 }<br>                 var m = room._id.match(/(W|E)(\d+)(N|S)(\d+)/);<br>                 var roomH = m[1]+(+m[2]+1)+m[3]+m[4], roomV = m[1]+m[2]+m[3]+(+m[4]+1);</p>]]></description><link>http://screeps.com/forum/post/2369</link><guid isPermaLink="true">http://screeps.com/forum/post/2369</guid><dc:creator><![CDATA[daboross]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Error in engine_processor spawning creep after setting custom terrain on Invalid Date]]></title><description><![CDATA[<p>Pull request submitted for an actual fix (not just a hack around the issue): <a href="https://github.com/screeps/backend-local/pull/1" rel="nofollow noreferrer">https://github.com/screeps/backend-local/pull/1</a></p>]]></description><link>http://screeps.com/forum/post/2370</link><guid isPermaLink="true">http://screeps.com/forum/post/2370</guid><dc:creator><![CDATA[daboross]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Error in engine_processor spawning creep after setting custom terrain on Invalid Date]]></title><description><![CDATA[<p>This is fixed in 2.0.0.</p>]]></description><link>http://screeps.com/forum/post/2371</link><guid isPermaLink="true">http://screeps.com/forum/post/2371</guid><dc:creator><![CDATA[artch]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>