2026-09-04, 10:40 PM
I encountered a destructive migration issue upgrading Jellyfin 10.11.8 to 12.0 RC7 on Windows.
MIND YOU. I did force ffmpeg 9 encoding on my old setup.
Configuration:
Jellyfin 12.0 RC7 native Windows install
Database from Jellyfin 10.11.8
Media on an internal SATA HDD at E:\Video
Libraries:
E:\Video\MOVIES
E:\Video\TV SHOWS
E:\Video\DOCUMENTARIES
During startup, migration 20260113120000_MigrateLinkedChildren reported:
Checking 20548 items for missing files.
Found 3045 stale items to remove.
It then deleted valid movies and episodes whose files were present and accessible. Some deletions produced:
SQLite Error 19: 'FOREIGN KEY constraint failed'
UPDATE "LinkedChildren" SET "ChildId" = ...
The drive was online, connected by SATA—not USB—and the logged paths were verified to exist. A filesystem check and SMART check also passed.
The problematic RC7 migration is:
Jellyfin.Server/Migrations/Routines/
20260113120000_MigrateLinkedChildren.cs
MigrateLinkedChildren.Perform() migrates legacy relationship JSON, but then also calls CleanupStaleFileEntries(). In my database, that cleanup incorrectly classified 3,045 valid media entries as stale. The detection completed in milliseconds, despite checking over 20,000 entries.
Recovery
I:
Stopped Jellyfin.
Restored the pre-migration database backup.
Marked 20260113120000_MigrateLinkedChildren as applied so RC7 would not execute its destructive cleanup.
Ran a standalone migration that only:
Parsed LinkedChildren, LocalAlternateVersions, and LinkedAlternateVersions from BaseItems.Data.
Resolved child IDs by existing IDs and paths.
Inserted the resulting rows into LinkedChildren.
Did not delete any library items.
Migrated all 260 expected relationships.
Removed 515 orphaned BaseItemImageInfos rows left by the failed deletion attempts.
Ran PRAGMA foreign_key_check and PRAGMA integrity_check.
Final result:
LinkedChildren: 260
Foreign-key errors: 0
Integrity check: ok
Movies: 449
Episodes: 6095
Series: 58
Jellyfin then started normally with all libraries restored.
The safe migration helper I used is designed to be idempotent and validates database integrity before committing.
I believe stale-file cleanup should not be part of this relationship migration, or it should require substantially stronger safeguards before deleting records.
MIND YOU. I did force ffmpeg 9 encoding on my old setup.
Configuration:
Jellyfin 12.0 RC7 native Windows install
Database from Jellyfin 10.11.8
Media on an internal SATA HDD at E:\Video
Libraries:
E:\Video\MOVIES
E:\Video\TV SHOWS
E:\Video\DOCUMENTARIES
During startup, migration 20260113120000_MigrateLinkedChildren reported:
Checking 20548 items for missing files.
Found 3045 stale items to remove.
It then deleted valid movies and episodes whose files were present and accessible. Some deletions produced:
SQLite Error 19: 'FOREIGN KEY constraint failed'
UPDATE "LinkedChildren" SET "ChildId" = ...
The drive was online, connected by SATA—not USB—and the logged paths were verified to exist. A filesystem check and SMART check also passed.
The problematic RC7 migration is:
Jellyfin.Server/Migrations/Routines/
20260113120000_MigrateLinkedChildren.cs
MigrateLinkedChildren.Perform() migrates legacy relationship JSON, but then also calls CleanupStaleFileEntries(). In my database, that cleanup incorrectly classified 3,045 valid media entries as stale. The detection completed in milliseconds, despite checking over 20,000 entries.
Recovery
I:
Stopped Jellyfin.
Restored the pre-migration database backup.
Marked 20260113120000_MigrateLinkedChildren as applied so RC7 would not execute its destructive cleanup.
Ran a standalone migration that only:
Parsed LinkedChildren, LocalAlternateVersions, and LinkedAlternateVersions from BaseItems.Data.
Resolved child IDs by existing IDs and paths.
Inserted the resulting rows into LinkedChildren.
Did not delete any library items.
Migrated all 260 expected relationships.
Removed 515 orphaned BaseItemImageInfos rows left by the failed deletion attempts.
Ran PRAGMA foreign_key_check and PRAGMA integrity_check.
Final result:
LinkedChildren: 260
Foreign-key errors: 0
Integrity check: ok
Movies: 449
Episodes: 6095
Series: 58
Jellyfin then started normally with all libraries restored.
The safe migration helper I used is designed to be idempotent and validates database integrity before committing.
I believe stale-file cleanup should not be part of this relationship migration, or it should require substantially stronger safeguards before deleting records.

