"Data saving error on Pavlovia (Running mode): 'credit reserved for this session has been released' — 0% submitted, 0% aborted"

OS: Various (participant devices; also reproduced on my own machine)
PsychoPy version: 2023.1.3 (PSYCHOJS)
Standard Standalone Installation? n — online only via Pavlovia (PsychoJS)

URL of experiment: Pavlovia (Running mode)

What are you trying to achieve?:
Running a listening effort study online via Pavlovia, Running mode, credit-based.

What did you try to make it work?:

  • Confirmed credits are not the issue: 48 available, 2 consumed, 0 reserved.
  • Confirmed “Save incomplete results” is enabled.
  • Confirmed that it was not an error local to the participant; reproduced error myself.
  • Checked the data files: no data was saved for the listening effort (LE) task at all — only an earlier task in the same experiment (BLP) saved successfully.
  • Checked the dashboard stats: shows 0% submitted and 0% aborted for this experiment, despite 2 credits having been consumed and the error occurring twice.

Link to the most relevant existing thread you have found:
Error: "credit reserved for this session has been released" — 100% aborted sessions in Running mode — same error message, also in Running mode with credits confirmed available, though that thread shows 100% aborted rather than 0%/0% like mine.

What specifically went wrong when you tried that?:
A participant got partway through the LE task and received the following error:

"Unfortunately we encountered the following error:

  • when uploading participant’s results for experiment: val81/listening-effort-bo
  • either the credit reserved for this session has been released or no credit was previously reserved: results cannot be saved."

I reproduced the identical error myself testing the live Running URL afterward. This happened on our first live Running-mode session; the same task worked without issue when Piloting the day before.

Happy to share more project details (repo structure, task code, or a test link) if useful for debugging. Has anyone found a workaround, or is this something the Pavlovia team is already tracking?

Edit:
When I clicked on the experiment link here, it took me to the first page that the participants see but also had this error appear:

Unfortunately we encountered the following error:

  • TypeError: Cannot read properties of undefined (reading ‘getLastResetTime’)

Try to run the experiment again. If the error persists, contact the experiment designer

Edit 2:

I think I was getting ahead of myself. The aborted trials have since appeared as such.

How long does the overall experiment take?

If you add me (Wake) to the repo then I could fork it so you could test with a licence instead of using credits.

Personally I wouldn’t have “Save incomplete results” ticked if using credits, since that could get very expensive. I also avoid “periodic saving” in case it causes a conflict at the end of the experiment.

Is there a reason why you are using a PsychoPy from 2023 and haven’t upgraded?

According to this thread I suspect that your getLastResetTime error is a brief memory glitch. How stable is your internet connection?

Hello! Thanks for replying.

The experiment (4 tasks total) ranges but typically lasts around 60 minutes depending on the participant.

My internet and the participant’s internet were both fine.

Not sure why we chose specifically a PsychoPy from 2023. Previously when we were testing the PsychoPy tasks locally, we had a version discrepancy problem, where the tasks were built on an older version and then trying to get tested on a newer one. I’m guessing that’s where it came from?

Thank you for the recommendation regarding “Save incomplete results.” I will make these changes now.

Thank you. I’ve forked the experiment to Pavlovia so you can test it on a licence. Feel free to try to replicate the issue and test edits there.

How did you write this? I can’t see any psyexp files. I therefore suspect that the issue is related to code automatically added to PsychoPy experiments when exported to PsychoJS.

Thank you for forking it! I will try it right now.

Since previously our experiment was written in Python instead of being built in the builder, we decided to try and replicate the Python code in JavaScript for the exporting to Pavlovia.

Tried the experiment and got the following error after completing the second task (much like the 2 previously aborted attempts using credits): **
Error**

Unfortunately we encountered the following error:

  • when updating the value of the INTEGER record associated with key: [“iat_counter”]
  • unable to find a record associated with the given key

Try to run the experiment again. If the error persists, contact the experiment designer.

I’ve added an integer shelf entry called iat_counter

Does it need any more shelf entries?

This is not something I would ever attempt myself. I would always rewrite it in Builder.

This is not something I would ever attempt myself. I would always rewrite it in Builder.

Understood, will communicate this to the others on the team.

In the meantime, should we resolve this by rewriting it in the Builder? Previously, the pilot rounds of the experiment all worked seamlessly.

Thank you for adding the shelf entry! I don’t think it should need any more. Is this where we run through it again?

Yes, you could try running it through again.

At this point it might be possible to create a minimal experiment in Builder so you can check your code with the compiled code relating to saving the data and exiting. You might also need to check the correct libraries are being imported (comparing the contents of index.html)

Just tested it, was able to do the experiment through to the end!

Cool. I’ve just switched my copy to credit mode, assigned some credits and turned off incomplete data saving. Now try running it again to see if credits are the issue.

Credits do seem to be the issue. I completed the experiment back to where we originally got stuck and got the following error:
Unfortunately we encountered the following error:

  • when uploading participant’s results for experiment: test-suite/listening-effort-bo
  • either the credit reserved for this session has been released or no credit was previously reserved: results cannot be saved

Try to run the experiment again. If the error persists, contact the experiment designer.

This round also only saved the first task data.

Does the experiment include code that saves the data part way through?

Something like that, it has the following code that saves a separate data file after each experiment:
await psychoJS.experiment.save({ tag: ‘_BLP’, clear: true }); // after runBLP()
await psychoJS.experiment.save({ tag: ‘_LE’, clear: true }); // after runLE()
await psychoJS.experiment.save({ tag: ‘_IAT’, clear: true }); // after runIAT()
await psychoJS.experiment.save({ tag: ‘_MGT’, clear: true }); // after runMGT()

I think we have enough evidence to know this this is the issue.

When you launch an experiment then a credit gets reserved. When you save the data it gets consumed. If you try to save more data with the same credit, you will get an error message because that credit is no longer available. If you have a license then credits don’t get reserved or checked.

I think you have three options.

  1. Buy a licence.
  1. Remove the extra data saves so you save everything at the end.

  2. Split the experiment into four and daisy chain so each one reserves a new credit.

I see, thank you for all of your help and for being so quick! I will relay your recommendations to the rest of my team. This is our first time working with Pavlovia, so this has been a slow learning experience.

If we do encounter another error in the future, should I reply to this thread or should I make a new thread?

You’re welcome. If you have another issue, please start a new thread unless it is related to psychoJS.experiment.save in your experiment or credits.

Hello again,

So I’ve gone with solution 2, removing the extra data saves and saving at the end. This worked, I was able to get all 4 tasks’ data fine. The participant still encounters an error that says the following right at the end, and Pavlovia registers the attempt as “aborted” even though the participant completed the experiment and I was able to get the data with no issues:

Unfortunately we encountered the following error:

  • when terminating the experiment
  • when uploading participant’s results for experiment: val81/listening-effort-bo
  • either the credit reserved for this session has been released or no credit was previously reserved: results cannot be saved

Try to run the experiment again. If the error persists, contact the experiment designer.

Functionally, this error isn’t getting in the way of anything. It’s mostly the technical part of Pavlovia thinking that the attempt was aborted when it was completed. I’m not sure if that’s an issue that we need to fix, but I thought I’d mention it here just in case it was indeed problematic. Thank you!

I wonder if the issue is that if you removed your code completely the data would get saved – the error message being due to Pavlovia’s standard attempt to save the data occurring immediately after your code save. Obviously, you should test this if you decide to fix it. However, if you are getting the data you need I don’t see an issue with your current version beyond the confusion it may cause your participants.