[Issue]: Failure post-upgrade to 10.8.1, constraint failure #3977

Closed
opened 2026-02-07 00:13:22 +03:00 by OVERLORD · 3 comments
Owner

Originally created by @tadgh on GitHub (Jun 29, 2022).

Please describe your bug

Just upgraded my container, encountering the following failure, logs are in this dpaste: https://dpaste.org/oiN4Q

Effectively it appears the root is

    today at 3:30:58 PMMicrosoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'FOREIGN KEY constraint failed'.
    today at 3:30:58 PM   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)

Causes the server not to come up at all.

I've attached the jellyfin db zipped here. If there is something I can do to fix my install (manual migrations or whatever) I would be happy to run them. Alternatively, I suppose there's always the fresh start route.

jellyfindb.zip

Any ideas?

Jellyfin Version

10.8.0

if other:

No response

Environment

- OS: Unraid
- Virtualization: Docker
- Clients: Browser
- Browser: Firefox
- FFmpeg Version: --
- Playback Method: --
- Hardware Acceleration: --
- Plugins: --
- Reverse Proxy: SWAG
- Base URL: -- 
- Networking:--
- Storage: --

Jellyfin logs

https://dpaste.org/oiN4Q

FFmpeg logs

No response

Please attach any browser or client logs here

No response

Please attach any screenshots here

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
Originally created by @tadgh on GitHub (Jun 29, 2022). ### Please describe your bug Just upgraded my container, encountering the following failure, logs are in this dpaste: https://dpaste.org/oiN4Q Effectively it appears the root is ``` today at 3:30:58 PMMicrosoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'FOREIGN KEY constraint failed'. today at 3:30:58 PM at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db) ``` Causes the server not to come up at all. I've attached the jellyfin db zipped here. If there is something I can do to fix my install (manual migrations or whatever) I would be happy to run them. Alternatively, I suppose there's always the fresh start route. [jellyfindb.zip](https://github.com/jellyfin/jellyfin/files/9005833/jellyfindb.zip) Any ideas? ### Jellyfin Version 10.8.0 ### if other: _No response_ ### Environment ```markdown - OS: Unraid - Virtualization: Docker - Clients: Browser - Browser: Firefox - FFmpeg Version: -- - Playback Method: -- - Hardware Acceleration: -- - Plugins: -- - Reverse Proxy: SWAG - Base URL: -- - Networking:-- - Storage: -- ``` ### Jellyfin logs https://dpaste.org/oiN4Q ### FFmpeg logs _No response_ ### Please attach any browser or client logs here _No response_ ### Please attach any screenshots here _No response_ ### Code of Conduct - [X] I agree to follow this project's Code of Conduct
OVERLORD added the bug label 2026-02-07 00:13:22 +03:00
Author
Owner

@spooksbit commented on GitHub (Jun 29, 2022):

Did you happen to delete a user or two at any point? I'm seeing that there are permissions/preferences that are tied to users that don't exist. It sounds like JF didn't delete those when the users were deleted originally, and now those permissions/preferences are left dangling which prevents the migration scripts from succeeding for you.

I was able to delete a few of these dangling records by running the following SQL commands on your database. After deleting them, I was able to get a 10.8.1 build to run on my local machine. I'm not sure if it's appropriate to send you the "fixed" database file, but if you have a tool like DB Browser for SQLite, you should be able to fix it on your machine.

DELETE FROM Preferences 
WHERE id IN (select p.Id FROM Preferences p LEFT JOIN Users u on u.Id = p.Preference_Preferences_Guid WHERE u.Id IS NULL)

DELETE FROM Permissions 
WHERE id IN (select p.Id FROM Permissions p LEFT JOIN Users u on u.Id = p.Permission_Permissions_Guid WHERE u.Id IS NULL)

I hope that can get you back up and running awhile.

For developers, the AddIndexesAndCollations migration is failing to complete because of non-existent user ids on the permissions/preferences tables. I don't understand how this could have happened, because these tables have RESTRICT on the FKs, which should have prevented the users from being deleted in the first place. I'm wondering if the above deletion script should be included in the migration to catch the cases where somehow there are dangling permissions/preferences.

@spooksbit commented on GitHub (Jun 29, 2022): Did you happen to delete a user or two at any point? I'm seeing that there are permissions/preferences that are tied to users that don't exist. It sounds like JF didn't delete those when the users were deleted originally, and now those permissions/preferences are left dangling which prevents the migration scripts from succeeding for you. I was able to delete a few of these dangling records by running the following SQL commands on your database. After deleting them, I was able to get a 10.8.1 build to run on my local machine. I'm not sure if it's appropriate to send you the "fixed" database file, but if you have a tool like DB Browser for SQLite, you should be able to fix it on your machine. ``` DELETE FROM Preferences WHERE id IN (select p.Id FROM Preferences p LEFT JOIN Users u on u.Id = p.Preference_Preferences_Guid WHERE u.Id IS NULL) DELETE FROM Permissions WHERE id IN (select p.Id FROM Permissions p LEFT JOIN Users u on u.Id = p.Permission_Permissions_Guid WHERE u.Id IS NULL) ``` I hope that can get you back up and running awhile. For developers, the `AddIndexesAndCollations` migration is failing to complete because of non-existent user ids on the permissions/preferences tables. I don't understand how this could have happened, because these tables have RESTRICT on the FKs, which should have prevented the users from being deleted in the first place. I'm wondering if the above deletion script should be included in the migration to catch the cases where somehow there are dangling permissions/preferences.
Author
Owner

@tadgh commented on GitHub (Jun 30, 2022):

Thanks much, I'll go ahead and try to execute those commands myself and report back

@tadgh commented on GitHub (Jun 30, 2022): Thanks much, I'll go ahead and try to execute those commands myself and report back
Author
Owner

@tadgh commented on GitHub (Jun 30, 2022):

Yup, all set, thankfully sqlite3 is installed in the docker container :)

docker exec -it jellyfin-container /bin/bash
cd /config/data
sqlite3 jellyfin.db
DELETE FROM Preferences 
WHERE id IN (select p.Id FROM Preferences p LEFT JOIN Users u on u.Id = p.Preference_Preferences_Guid WHERE u.Id IS NULL);
DELETE FROM Permissions 
WHERE id IN (select p.Id FROM Permissions p LEFT JOIN Users u on u.Id = p.Permission_Permissions_Guid WHERE u.Id IS NULL);
@tadgh commented on GitHub (Jun 30, 2022): Yup, all set, thankfully sqlite3 is installed in the docker container :) ``` docker exec -it jellyfin-container /bin/bash cd /config/data sqlite3 jellyfin.db DELETE FROM Preferences WHERE id IN (select p.Id FROM Preferences p LEFT JOIN Users u on u.Id = p.Preference_Preferences_Guid WHERE u.Id IS NULL); DELETE FROM Permissions WHERE id IN (select p.Id FROM Permissions p LEFT JOIN Users u on u.Id = p.Permission_Permissions_Guid WHERE u.Id IS NULL); ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#3977