| Reference | Downloads | Github

TypeError: is not a function after Pavlovia finished

URL of experiment:

Description of the problem:

Hi there,
I’m piloting a language experiment on Pavlovia and at the very end - after the “thank you”-end-screen has already closed - I receive a TypeError: Symbol.keyFor is not a function error message. It doesn’t matter if the end screen is finished per key press or on its own after 15 seconds. I’m also asked if I want to save the Output-File (the data is stored just fine), so I really don’t see what’s wrong with my experiment.

When I press OK on the error message, it starts to initalize the experiment again like at the beginning but not written black against white but black against grey. However, it never starts again.
In my piloting statistics all my runs are listed under “aborted” and none under “completed”.

Has anyone come across something similar?

All the best,

A colleague found my error: I unknowingly used “Symbol” as a variable name in my experiment. But “Symbol” is also a JavaScript keyword. So there was some sort of conflict between my variable name and the JS key word.
After renaming my variable, everything worked fine.


I have a similar problem. URL of experiment: or Sign in · GitLab

When I pilot my experiment on Pavlovia, after the very last trial, the screen is stuck on this:

And the browser devel tools console shows these error messages:

I don’t think I used “m.push” or “this.plugins[t].destroy” as variables in my experiment. So really not sure what is wrong… Any help would be greatly appreciated!

I just clicked on your link and was a walking figure on the left for a second or so then one item on the right then a blank screen. Return then moved to the next figure. When does it give the error?

Thanks @wakecarter! What you described is one trial. There are 24 trials in total. When the last trial is finished (after you press return for the last time) that’s when the crush and error happens.

Sorry – I’ve just been through the trials and found the same as you. What does your last routine look like? Do you have any code components?

This is my experiment flow:

This is the last routine “responsePeriod”:

There’s no code component in the last routine but there are code components in the previous routines “stimLocIndication” and “dynamicWalker”.

If I add an ending routine outside the “trials” loop, with just a 3-second text component saying “Thank you”, the crash still happens after the “Thank you” text.

Do you have any code in End Experiment tabs?

No, there’s no code in the End Experiment tabs.

That’s me stumped then. It’s not giving any errors until after it ends the experiment (as it’s closing the windows I think).

Try turning the experiment to inactive and then activating it again.

Just did that. Still have the same problem :frowning:

Have you found any solutions? I am having the same problem.

Hey, I removed some of the crib sheet code in the beginning,

Array.prototype.append = [].push
Object.prototype.upper = “”.toUpperCase;

These were all removed, I am not sure which one was the culprit. Everything works now though!

1 Like

I removed those lines and it works now! Thank you!

The second one is missing a semi-colon and the last one looks like it has intelligent quotes. Copying and pasting from the crib sheet to a code component should give:

Array.prototype.append = [].push;
Object.prototype.upper = "".toUpperCase;

My code was copied from the crib sheet and all the semi-colons and quotes were correct. But it still led to the end-of-experiment crash before I deleted those lines…

The problem line is Object.prototype.upper = "".toUpperCase; so I’ve added a warning to my crib sheet.

1 Like