[Resolved] Massive script error



  • Hello everyone, I'm new to coding so debuging is hard still. I'm not sure what happened. I had not edited my scripts for a few minutes and out of nowhere the console spams this:

    TypeError: Cannot read property 'message' of null
    at Object.exports.evalCode (/opt/engine/dist/core/core.js:1350:14)
    at Object.exports.runCode (/opt/engine/dist/game/game.js:483:22)
    at connectPromise.then.then.e (/opt/engine/dist/core/runtime.js:156:18)
    at _fulfilled (/opt/engine/dist/core/node_modules/q/q.js:834:54)
    at self.promiseDispatch.done (/opt/engine/dist/core/node_modules/q/q.js:863:30)
    at Promise.promise.promiseDispatch (/opt/engine/dist/core/node_modules/q/q.js:796:13)
    at /opt/engine/dist/core/node_modules/q/q.js:604:44
    at runSingle (/opt/engine/dist/core/node_modules/q/q.js:137:13)
    at flush (/opt/engine/dist/core/node_modules/q/q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickDomainCallback (internal/process/next_tick.js:122:9)

    I do not know what this error is from. can anyone help me?



  • At some point your script got an object (perhaps using GetObjectById), or it searched for an object using a Find method, but there was no result (a Null instead of an object). Your script didn't check, it just assumed the method returned an object. You need to check.



  • Thanks MyrddinE, I disabled every module and re-enabled them one at a time and found that for some reason screeps-profiler was causing the issue. I probably broke it. I'm not even close to actually benefiting from it. So, I will just leave it off.

       *Edit: Most likely it was how my defense acquired targets I had reverted to a working variant without realising. It takes a few minutes before the error shows up.