Error message when terminating the experiment

URL of experiment:

Description of the problem:
Dear all,

I am currently setting up an experiment on Pavlovia. The experiment runs smoothly, however, at the end when terminating the experiment, participants get an error message, saying:

Unfortunately we encountered the following error:

  • when terminating the experiment
  • when uploading participant’s results for experiment
  • not enough previously reserved credits

I am confused about this message as 1) I do have enough credits assigned to the experiment and 2) the participants’ data is saved on my account.

Has anyone encountered this before and could let me know how to get rid of the error message to not continue bothering participants?

Thanks a lot in advance!

I’m glad to hear the data is getting saved. Here are some questions>

How long does the experiment take?

Have you been releasing reserved credits?

Is there anything complex about the data such as daisy chaining two experiments or embedding a Pavlovia Survey?

Do you have any code in End Experiment tabs?

Do you have anything in the Completed URL field?

Thanks for your quick response.

  1. How long does the experiment take?
  • Around 10 minutes
  1. Have you been releasing reserved credits?
  • No, I only used the update assigned credits button.
  1. Is there anything complex about the data such as daisy chaining two experiments or embedding a Pavlovia Survey?
  • Before the experiment I use a Qualtrics survey. At the end of Qualtrics survey participants are automatically forwarded to the Pavlovia experiment and their Qualtrics participant number is caught by Pavlovia.
  1. Do you have any code in End Experiment tabs?
  • I end the experiment with a random sequence of letters that I coded from scratch and ask participants to end the experiment simply by closing the tab or pressing esc.

After the routine where I implement the random sequence of letters.
I end this script with this code snippet:

function importConditions(currentLoop) {
return async function () {
psychoJS.importAttributes(currentLoop.getCurrentTrial());
return Scheduler.Event.NEXT;
};
}

async function quitPsychoJS(message, isCompleted) {
// Check for and save orphaned data
if (psychoJS.experiment.isEntryEmpty()) {
psychoJS.experiment.nextEntry();
}

// Save data to Pavlovia
psychoJS.experiment.save({saveFormat: ‘csv’});

psychoJS.window.close();
psychoJS.quit({message: message, isCompleted: isCompleted});

return Scheduler.Event.QUIT;
}

  1. Do you have anything in the Completed URL field?
  • No.

Why are you asking participants to end the experiment by aborting it (pressing escape)? Do you have partial data saving turned on? The reason for the error message is almost certainly because your End Experiment code saves the data (using up the credit token) just before Pavlovia makes its own attempt to save the same data.

You are right. I removed the following line and the error message does not show up anymore but the data is still saved.

// Save data to Pavlovia
psychoJS.experiment.save({saveFormat: ‘csv’});

Thanks a lot for your help!