Sugarcube 2.33.0 - I keep getting an error that appears before one specific passage loads, but doesn't do anything beyond that that I have noticed

Twine Version: 2.3.9
Story Format: Sugarcube 2.33.0

I couldn’t find anyone talking about it so I don’t know what would be causing it, especially since its not doing anything else as far as I can tell. The error appears in a white box before the passage screen loads.

Apologies! An error has occurred. You may be able to continue, but some parts may not work properly.

Error: TempState.macroTypeQueue is undefined.

Stack Trace:
g/r<@file:///C:/Users/magic_71a2140/Downloads/Twine-stuff/game/Stories/12%20hours%20to%20end%20the%20world17.html:678:5746

Any advice on why it could be happeing, or how to force it to stop appearing, would be much appreciated. Thank you.

It’s hard to tell without seeing what code you’re using which might invoke such an error. However, since it appears that the error might be related to the <<type>> macro, then you might want to update to SugarCube v2.33.1, which improves that macro a bit.

If that isn’t it, then it’s likely something in your JavaScript section or StoryInit passage (or possibly a “widget” tagged passage). I’d try commenting out chunks of code until you can narrow things down to where the problem is. To comment out code you can simply put it inside this:

/*
    Code goes here.
    Can include multiple lines.
*/

Simply comment out enough that the error goes away, and then comment out less and less, until the error reappears. Whatever new bit of code you uncommented last will likely be where the error is triggered from.

Hope that helps! :grinning:

I tried updating to that version of sugar cube and it didn’t help. I think I wouldnt be able to get the rest of the story up to the point of the passage with the error to display properly if I were to comment out the javascript. Theres no way to like force the error popup is there? I genuinely can’t find any problems it is causing, and when I end up uploading this I’d like it to not appear so it looks a touch more polished.

Ah, you made it sound like the problem was happening at the very beginning, since you said that the problem happens “before the passage screen loads.” I assumed that meant it happened before the first passage loads.

If you need to test on a later passage, simply save the game just before the problem occurs, comment out the code, publish the game, reload the HTML (CTRL+F5), load the save, and then go to the passage to trigger the error.

Doing what I just described should do it. However, you can’t trigger it otherwise without knowing the cause of the problem, and the cause of the problem is what we’re trying to figure out.

Basically, you need to figure out the cause, and then either fix it yourself, or if you can’t do that, show us the code so we can take a look.

Let us know what you figure out.

Well I just tried commenting out all the javascript and the error didn’t go away. Then took away the StoryInit passage, and that worked. But when I put the StoryInit passage back the error went away, and I have literally no idea why this happened.

It’s been passed around a few times in threads here, but I’ve personally found this a great tool for troubleshooting. It doesn’t catch everything, but can catch a good amount of little bugs or typos in the code.

https://goctionni.github.io/SugarValidator/index.html

Just continue to narrow down the code that triggers the problem in the StoryInit passage like that.

Either that, or show us the code, if it’s not a huge amount.