Unable to Sync to Pavlovia on non-new experiment (wrong project ID)

URL of experiment: Pavlovia

Description of the problem:
Greetings, wise people of the community. I am in need of your assistance.
The thing I describe is reproducible, meaning it happened to me every time, several times and I can repeat it at will, should I desire more frustration in my life.
I’ve created a local project, synced it for the first time - it asked me to create a project, which I did. After that, I made some changes and synced it several times without any problem. Several days later (I’m not sure what triggers it - may be a reboot) I’ve opened the local project again, made some changes, tried to sync and got a 404 error (full text at the bottom of the post).
This error contains a message stating “Could not find GitLab project with id 231943
This is totally understandable, as the GitLab ID of the project is 234217.
How can I tell PsychoPy that the ID is wrong? Or am I wrong and the ID thing is irrelevant? How should I solve this then?

Stuff I tried:

  1. Deleting the Pavlovia project and the .git folder allows me to have the latest version synced by creating a new project, but I don’t want to do that each time I change something, I make changes frequently and test them online.
  2. Finding my project in builder online search and hitting sync does update my GitLab repository, but the experiment itself on the Pavlovia is not updated, so now I have Pavlovia and GitLab project unsynced.

Here’s the full error text:

Traceback (most recent call last):
  File "C:\Program Files\PsychoPy\lib\site-packages\gitlab\exceptions.py", line 304, in wrapped_f
    return f(*args, **kwargs)
  File "C:\Program Files\PsychoPy\lib\site-packages\gitlab\mixins.py", line 112, in get
    server_data = self.gitlab.http_get(path, **kwargs)
  File "C:\Program Files\PsychoPy\lib\site-packages\gitlab\client.py", line 662, in http_get
    result = self.http_request(
  File "C:\Program Files\PsychoPy\lib\site-packages\gitlab\client.py", line 628, in http_request
    raise gitlab.exceptions.GitlabHttpError(
gitlab.exceptions.GitlabHttpError: 404: 404 Project Not Found

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\projects\pavlovia.py", line 652, in project
    self._project = self.session.gitlab.projects.get(self.id)
  File "C:\Program Files\PsychoPy\lib\site-packages\gitlab\v4\objects\projects.py", line 782, in get
    return cast(Project, super().get(id=id, lazy=lazy, **kwargs))
  File "C:\Program Files\PsychoPy\lib\site-packages\gitlab\exceptions.py", line 306, in wrapped_f
    raise error(e.error_message, e.response_code, e.response_body) from e
gitlab.exceptions.GitlabGetError: 404: 404 Project Not Found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\pavlovia_ui\menu.py", line 114, in onSync
    syncProject(parent=self.parent, project=self.parent.project)
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\pavlovia_ui\project.py", line 720, in syncProject
    if not project.localRoot:
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\projects\pavlovia.py", line 735, in localRoot
    if self.project.path_with_namespace in knownProjects:
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\projects\pavlovia.py", line 655, in project
    raise KeyError(f"Could not find GitLab project with id {self.id}.")
KeyError: 'Could not find GitLab project with id 231943.'

We just had pretty much the same thing today. What was odd, that all other experiments (and new ones) were fine and sync’d ok the second time. It was this one particular experiment that it wasn’t happy with (even after moving the folder, deleting the project + git folders etc).

Every time it kept pushing initially and created a new project, but then on a resync it would pick up an old Gitlab ID from somewhere.

In the end we had to remove the .git folder + gitignore, simply rename the file and the Experiment Name under settings, and everything went fine (with no resyncing issues).

It seems at some point the project had been pushed early on, then deleted on Pavlovia - but in the background not fully deleted (i.e. nothing visible on Gitlab/Pavlovia any longer, but something cached/lingering behind the scenes).

My guess is that PsychoPy/Pavlovia tries to do match on Pavlovia/Gitlab for the experiment name under the logged in account, and if it finds a match, assigns the found Gitlab ID to the project. Renaming the experiment name meant it couldn’t find anything, so kept the Gitlab ID allocated on first sync.

Hope this helps.

I think it is the .git folder where these old IDs are coming from, especially if deleting the .git folder fixed it for you. Deleting on Pavlovia after the first push would make sense - as deleting on Pavlovia doesn’t change your local git repo, so it would still be looking for an experiment which no longer exists online, even though you’ve since created a new one to replace it.

Ah apologies for not being clearer - but it wasn’t just deleting the .git folder that fixed it. Just doing that would result in the same issue, an old ID would get picked up from somewhere after a second resync.

The breakthrough came when we simply changed the name of the experiment under “Experiment Settings” to something new and deleted .git and created a new project. After that, it kept its new project ID and didn’t change to the old one on subsequent resyncs. That’s why we were wondering if it was something picked up from gitlab based on the old name and from an old project that no longer visibly existed (i.e cached or not fully deleted).

2 Likes