2026-10-14, 05:14 PM
(This post was last modified: 2026-10-29, 01:40 PM by TheDreadPirate. Edited 6 times in total.)
After successfully recovering @cskaryd 's database over in this thread, I decided it should be preserved here. This is the start of a collection of SQLite procedures for recovering a corrupt Jellyfin database. Hopefully this collection continues to grow.
Make a copy of jellyfin.db before attempting any of the procedures below.
Takes a deep breath
I repeat, make a copy of jellyfin.db before attempting any of the procedures below.
************
If you have a corrupt database and the procedures here do not fix it, I would love if you shared your database with me so I can poke and prod it and maybe figure out what is wrong and how to fix it.
Zip it up (databases are highly compressible) and use your preferred file sharing site, Google Drive, etc., and send me a PM. DO NOT POST THE LINK IN A REPLY!!
************************************************
Failed during: 20260113120000_MigrateLinkedChildren
Error Message: "Dashes are in the wrong position for GUID parsing."
Circumstances: Upgrading from 10.11.11 to 12.2
Likely root cause: The user reported that when they created a new music library the server crashed during that initial scan. When the user restarted Jellyfin and attempted to continue scanning it would not proceed and the user deleted the music library. The residual database entries were never cleaned up and one BaseItem entry had a BLOB in the Id field, in addition to the indices failing integrity checks.
Original thread: https://forum.jellyfin.org/t-solved-migr...id-parsing
Comment: I've seen other users with different error messages, but that also failed on this same migration. This procedure may also apply to those situations.
Procedure for repair:
Find the invalid BaseItems.
Copy the IDs to a text editor. Then attempt to reindex the DB and delete the bad entries. Repeat the DELETE command until all the Id's are deleted. THEN run the REINDEX command again.
In @cskaryd 's case, the bad BaseItem had a BLOB in the Id field and I had to use an another field as a unique identifier (file path) for the delete command. Keep that in mind if the DELETE command fails.
Once they started Jellyfin, the migration it initially failed on started cleaning up the residual music entries in the database. All the migrations completed and they successfully upgraded from 10.11.11 to 12.2.
************************************************
Failed during: 20260113120000_MigrateLinkedChildren
Error Message: No logs with Information level logs other than starting the migration. With the Default, System, and Microsoft log levels set to debug you see the following query run over and over again
Circumstances: Upgrading from 10.11.9 to 12.4
Likely root cause: The user reported that they've tried to migrate to 10.11.10 when it was new, and 10.11.11 and 12.0. All hung during migration.
Original thread: Originated from Discord/Matrix chat
Comment: N/A
Procedure for repair:
Yep. That is it.
Make a copy of jellyfin.db before attempting any of the procedures below.
Takes a deep breath
I repeat, make a copy of jellyfin.db before attempting any of the procedures below.
************
If you have a corrupt database and the procedures here do not fix it, I would love if you shared your database with me so I can poke and prod it and maybe figure out what is wrong and how to fix it.
Zip it up (databases are highly compressible) and use your preferred file sharing site, Google Drive, etc., and send me a PM. DO NOT POST THE LINK IN A REPLY!!
************************************************
Failed during: 20260113120000_MigrateLinkedChildren
Error Message: "Dashes are in the wrong position for GUID parsing."
Circumstances: Upgrading from 10.11.11 to 12.2
Likely root cause: The user reported that when they created a new music library the server crashed during that initial scan. When the user restarted Jellyfin and attempted to continue scanning it would not proceed and the user deleted the music library. The residual database entries were never cleaned up and one BaseItem entry had a BLOB in the Id field, in addition to the indices failing integrity checks.
Original thread: https://forum.jellyfin.org/t-solved-migr...id-parsing
Comment: I've seen other users with different error messages, but that also failed on this same migration. This procedure may also apply to those situations.
Procedure for repair:
Find the invalid BaseItems.
Code:
sqlite3 jellyfin.db "SELECT Id, OwnerId FROM BaseItems WHERE length(Id) NOT IN (36,32) OR Id NOT LIKE '________-____-____-____-____________' or Id GLOB '*[^0-9A-Fa-f-]*';"Copy the IDs to a text editor. Then attempt to reindex the DB and delete the bad entries. Repeat the DELETE command until all the Id's are deleted. THEN run the REINDEX command again.
Code:
sqlite3 jellyfin.db "REINDEX;"
sqlite3 jellyfin.db "DELETE FROM BaseItems WHERE Id = 'Bad-ID-Goes-Here';"
sqlite3 jellyfin.db "REINDEX;"In @cskaryd 's case, the bad BaseItem had a BLOB in the Id field and I had to use an another field as a unique identifier (file path) for the delete command. Keep that in mind if the DELETE command fails.
Once they started Jellyfin, the migration it initially failed on started cleaning up the residual music entries in the database. All the migrations completed and they successfully upgraded from 10.11.11 to 12.2.
************************************************
Failed during: 20260113120000_MigrateLinkedChildren
Error Message: No logs with Information level logs other than starting the migration. With the Default, System, and Microsoft log levels set to debug you see the following query run over and over again
Code:
[12:35:33] [INF] [7] Microsoft.EntityFrameworkCore.Database.Command: Executed DbCommand (0ms) [Parameters=[], CommandType='Text', CommandTimeout='60']
INSERT OR IGNORE INTO "__EFMigrationsLock"("Id", "Timestamp") VALUES(1, '2026-10-29 12:35:33.4093378+00:00');
SELECT changes();Likely root cause: The user reported that they've tried to migrate to 10.11.10 when it was new, and 10.11.11 and 12.0. All hung during migration.
Original thread: Originated from Discord/Matrix chat
Comment: N/A
Procedure for repair:
Code:
sqlite3 jellyfin.db "DELETE FROM __EFMigrationsLock WHERE Id = 1;"Yep. That is it.

