Self-hosted Joplin DB corrupted?

Operating system

Linux

Joplin version

3.3.3

Desktop version info

3.2.12

Sync target

Joplin Server

What issue do you have?

I'm using a self-hosted Joplin Server running in a Docker container that is accessed by about 30 people who use different Joplin desktop versions.
A few days ago we noticed that Joplin no longer synchronizes. There is no error message and it shows the sync as successful - But nothing happens. Notebooks and notes aren't actually synced.

After looking at the logs of the Docker container the Postgres database runs in, I've noticed that the log is continuously spammed with these messages:

2025-03-12 10:38:38.241 UTC [44] ERROR: duplicate key value violates unique constraint "user_items_user_id_item_id_unique"
2025-03-12 10:38:38.241 UTC [44] DETAIL: Key (user_id, item_id)=(7gWYUl6qTKEilrIlX62wjf, v9bTfRvMfEp31mOSuqmvZH) already exists.
2025-03-12 10:38:38.241 UTC [44] STATEMENT: insert into "user_items" ("created_time", "item_id", "updated_time", "user_id") values ($1, $2, $3, $4)

The error messages are always the same, it's only the user_id and item_id values that differ from one log entry to the next.
Now I'm not sure what to do. To me this reads like a primary key somehow exists multiple times? I've tried

SELECT user_id, item_id, COUNT()
FROM user_items
GROUP BY user_id, item_id
HAVING COUNT(
) > 1;

to see if there are any duplicates but couldn't find any.

Does anyone have any ideas how to handle this? I'm not sure how to go about trying to restore a corrupted database.
A few years ago there was a post about this exact problem but it never got solved.

Thanks in advance!