Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Can someone help me understand this error please?

Can someone explain what is " attribs"  please? I cannot find this anywhere... Also any suggestion of how to find where this occur? Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your script's code and click the "Save Script" button. We will then attempt to start running the scripts again.  More info...  If this script was installed from the Script Library, you might find help in the Community API Forum. For reference, the error message generated was:  TypeError: Cannot read property 'attribs' of undefined TypeError: Cannot read property 'attribs' of undefined at /home/node/d20-api-server/sheetworker_listeners.js:69:19 at Function.each (/home/node/d20-api-server/node_modules/underscore/underscore-node-f.cjs:1323:7) at attrReq (/home/node/d20-api-server/sheetworker_listeners.js:34:7) at Worker.onmessage (/home/node/d20-api-server/sheetworker_listeners.js:271:17) at ChildProcess.<anonymous> (/home/node/d20-api-server/node_modules/tiny-worker/lib/index.js:90:21) at ChildProcess.emit (events.js:314:20) at emit (internal/child_process.js:877:12) at processTicksAndRejections (internal/process/task_queues.js:85:21)
1648893090
Oosh
Sheet Author
API Scripter
attribs is the object where a character's attributes are stored - it's used internally, not directy exposed to the API. This error is from a script attempting to find an attribute on a non existent character, but that error stack is all internal functions so it's not very helpful in trying to track down the problem. Which scripts do you have installed, and are you able to reproduce the error by doing anything in particular? It'll be caused by something that interacts with character sheets.
I'm trying to fix this error for the Shaped sheet companion script. Just for testing I created a brand new campaign and the script works. Can I assume that something wrong in the campaign itself instead of the script?
1648970934

Edited 1648971485
Oosh
Sheet Author
API Scripter
Ohhhh.... I was about to point you to another recent thread of someone trying to fix the Companion script.... but that's also you :) I'm not sure how to get that error intentionally via API, as you'd never be referencing the attribs object directly - it isn't exposed. findObjs() and getAttrByName both reject a character ID if it isn't found, so the internal char.attribs reference never gets attempted. The only thing I can think of, if there's a reference to a character somewhere, and that character is being deleted before an attempt to find some attributes on it. For some reason the character ID is still passing muster with the API findObjs/getAttrByName function, so it proceeds with the internal process of searching the attribute docs at <characterReference>.attribs.models.find(attr => blahblahblah....) But since the data has been GC'd we've now got undefined.attribs.... ruh roh! undefined doesn't have an attribs key! So.... long story short, I would have a look for some .remove() calls on character objects. Try removing them (crude, but quick) to see if the error changes/moves/goes away. A better 'fix' might be to setTimeout them, to make sure the other operations get their chance to finish. Whatever method is being used to create / search / destroy the character object probably worked fine when it was written. The crashes may be due to changes Roll20's database flow, and might not manifest until the Campaign is dense enough for this mistiming to bubble to the surface. On the other hand, it's possible that it is just the one Campaign that's buggered. You could try transmogging everything over to the new Campaign where the script isn't crashing - my feeling is that the crashes will start once you have a large enough Journal though... With the Webpackiness of the script, it's very hard to follow what's going on (at least for me). It would help immensely to have the source, but it doesn't seem to be on the repo. edit - another thought. **If** this whole ordeal is the startup function doing it's "create a character sheet to do some sheet version detection shennanigans, then delete it" I would probably look for a way to skip it, or crush it with my kind boots. The sheet isn't getting functional updates any more, so if all that process does it cause crashes, get rid of it (easier said than done, I know).
Thank you Oosh! That's very helpful! I will dig further into the code and see what I can do.