"TypeError: Cannot read property 'forEach' of undefined" if new PathFinder enabled



  • After enabling new PathFinder sometimes a strange error displayed in console:

    ```

    [4:05:22 PM]TypeError: Cannot read property 'forEach' of undefined

    ```

    I can't localize exact part of code where it happens because it's only one string in console, but it occurs while first creeps start moving (in most cases by creep.moveTo(...)).

    Has someone noticed this error into their scripts?


  • Culture

    This has been going on for forever and it seems to occur randomly. Would love for it to be fixed.


  • Dev Team

    It is hard to say something without knowing the exact method which throws this error.



  • I've caught the exact stacktrace with "try-catch" around some huge parts of code:

    TRYCATCH: {} TypeError: Cannot read property 'forEach' of undefined TypeError: Cannot read property 'forEach' of undefined
    at makePathfindingGrid2 (/opt/engine/dist/game/rooms.js:170:35)
    at getPathfindingGrid2 (/opt/engine/dist/game/rooms.js:210:81)
    at searchOpts.roomCallback (/opt/engine/dist/game/rooms.js:229:30)
    at /opt/engine/dist/core/path-finder.js:116:31
    at Object.exports.search (/opt/engine/dist/core/path-finder.js:128:19)
    at Object.globals.PathFinder.search (/opt


  • Dev Team

    Thanks, fixed.