Jellyfin Forum
MigrateUserDatabase always fails - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: Troubleshooting (https://forum.jellyfin.org/f-troubleshooting)
+--- Thread: MigrateUserDatabase always fails (/t-migrateuserdatabase-always-fails)



MigrateUserDatabase always fails - prahal - 2024-10-13

Can you run the MigrateUserDatabase migration?
(I force it by removing these lines from config/migrations.xml

Code:
<ValueTupleOfGuidString>
      <Item1>5c4b82a2-f053-4009-bd05-b6fcad82f14c</Item1>
      <Item2>MigrateUserDatabase</Item2>
    </ValueTupleOfGuidString>
)


Each time I force the MigrateUserDatabase in jelllyfin config/migrations.xml
I get the error that "Jellyfin.Data.Entities.AccessSchedule cannot be serialized because it does not have a parameterless constructor."
This from https://github.com/jellyfin/jellyfin/blob/822d4075843cdd4634faf738c2fb69b6b3201d5a/Jellyfin.Server/Migrations/Routines/MigrateUserDb.cs#L93
my user policy.xml is:
Code:
<?xml version="1.0"?>
<UserPolicy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <IsAdministrator>true</IsAdministrator>
  <IsHidden>true</IsHidden>
  <IsDisabled>false</IsDisabled>
  <MaxParentalRating xsi:nil="true" />
  <BlockedTags />
  <EnableUserPreferenceAccess>true</EnableUserPreferenceAccess>
  <AccessSchedules />
  <BlockUnratedItems />
  <EnableRemoteControlOfOtherUsers>true</EnableRemoteControlOfOtherUsers>
  <EnableSharedDeviceControl>true</EnableSharedDeviceControl>
  <EnableRemoteAccess>true</EnableRemoteAccess>
  <EnableLiveTvManagement>true</EnableLiveTvManagement>
  <EnableLiveTvAccess>true</EnableLiveTvAccess>
  <EnableMediaPlayback>true</EnableMediaPlayback>
  <EnableAudioPlaybackTranscoding>true</EnableAudioPlaybackTranscoding>
  <EnableVideoPlaybackTranscoding>true</EnableVideoPlaybackTranscoding>
  <EnablePlaybackRemuxing>true</EnablePlaybackRemuxing>
  <ForceRemoteSourceTranscoding>false</ForceRemoteSourceTranscoding>
  <EnableContentDeletion>true</EnableContentDeletion>
  <EnableContentDeletionFromFolders />
  <EnableContentDownloading>true</EnableContentDownloading>
  <EnableSyncTranscoding>true</EnableSyncTranscoding>
  <EnableMediaConversion>true</EnableMediaConversion>
  <EnabledDevices />
  <EnableAllDevices>true</EnableAllDevices>
  <EnabledChannels />
  <EnableAllChannels>true</EnableAllChannels>
  <EnabledFolders />
  <EnableAllFolders>true</EnableAllFolders>
  <InvalidLoginAttemptCount>0</InvalidLoginAttemptCount>
  <LoginAttemptsBeforeLockout>-1</LoginAttemptsBeforeLockout>
  <EnablePublicSharing>true</EnablePublicSharing>
  <RemoteClientBitrateLimit>0</RemoteClientBitrateLimit>
  <AuthenticationProviderId>Emby.Server.Implementations.Library.DefaultAuthenticationProvider</AuthenticationProviderId>
</UserPolicy>

my user config.xml is:
Code:
<?xml version="1.0"?>
<UserConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <AudioLanguagePreference />
  <PlayDefaultAudioTrack>true</PlayDefaultAudioTrack>
  <DisplayMissingEpisodes>false</DisplayMissingEpisodes>
  <GroupedFolders />
  <SubtitleMode>Default</SubtitleMode>
  <DisplayCollectionsView>false</DisplayCollectionsView>
  <EnableLocalPassword>false</EnableLocalPassword>
  <OrderedViews />
  <LatestItemsExcludes />
  <MyMediaExcludes />
  <HidePlayedInLatest>true</HidePlayedInLatest>
  <RememberAudioSelections>true</RememberAudioSelections>
  <RememberSubtitleSelections>true</RememberSubtitleSelections>
  <EnableNextEpisodeAutoPlay>true</EnableNextEpisodeAutoPlay>
</UserConfiguration>


Code:
[07:55:01] [FTL] [1] : Failed to create/read logger configuration
System.ArgumentException: A source source must be provided. (Parameter 'source')
  at Serilog.Configuration.LoggerMinimumLevelConfiguration.Override(String source, LoggingLevelSwitch levelSwitch)
  at Serilog.Settings.Configuration.ConfigurationReader.<>c__DisplayClass11_1.<ApplyMinimumLevel>b__3(LoggerMinimumLevelConfiguration configuration, LoggingLevelSwitch levelSwitch)
  at Serilog.Settings.Configuration.ConfigurationReader.<>c__DisplayClass11_0.<ApplyMinimumLevel>g__ApplyMinimumLevelConfiguration|1(IConfigurationSection directive, Action`2 applyConfigAction)
  at Serilog.Settings.Configuration.ConfigurationReader.ApplyMinimumLevel(LoggerConfiguration loggerConfiguration)
  at Serilog.Settings.Configuration.ConfigurationReader.Configure(LoggerConfiguration loggerConfiguration)
  at Serilog.Configuration.LoggerSettingsConfiguration.Settings(ILoggerSettings settings)
  at Serilog.ConfigurationLoggerConfigurationExtensions.Configuration(LoggerSettingsConfiguration settingConfiguration, IConfiguration configuration, ConfigurationReaderOptions readerOptions)
  at Jellyfin.Server.Helpers.StartupHelpers.InitializeLoggingFramework(IConfiguration configuration, IApplicationPaths appPaths)
[07:55:01] [INF] [1] Main: Jellyfin version: 10.9.11
[07:55:01] [INF] [1] Main: Environment Variables: ["[JELLYFIN_CACHE_DIR, /cache]", "[JELLYFIN_FFMPEG, /usr/lib/jellyfin-ffmpeg/ffmpeg]", "[JELLYFIN_DATA_DIR, /config]", "[JELLYFIN_LOG_DIR, /config/log]", "[JELLYFIN_WEB_DIR, /jellyfin/jellyfin-web]", "[JELLYFIN_CONFIG_DIR, /config/config]"]
[07:55:01] [INF] [1] Main: Arguments: ["/jellyfin/jellyfin.dll"]
[07:55:01] [INF] [1] Main: Operating system: Debian GNU/Linux 12 (bookworm)
[07:55:01] [INF] [1] Main: Architecture: Arm64
[07:55:01] [INF] [1] Main: 64-Bit Process: True
[07:55:01] [INF] [1] Main: User Interactive: True
[07:55:01] [INF] [1] Main: Processor count: 6
[07:55:01] [INF] [1] Main: Program data path: /config
[07:55:01] [INF] [1] Main: Log directory path: /config/log
[07:55:01] [INF] [1] Main: Config directory path: /config/config
[07:55:01] [INF] [1] Main: Cache path: /cache
[07:55:01] [INF] [1] Main: Web resources path: /jellyfin/jellyfin-web
[07:55:01] [INF] [1] Main: Application directory: /jellyfin/
[07:55:02] [INF] [1] Emby.Server.Implementations.AppBase.BaseConfigurationManager: Setting cache path: /cache
[07:55:02] [INF] [1] Emby.Server.Implementations.ApplicationHost: Loading assemblies
[07:55:02] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly Jellyfin.Plugin.Bookshelf, Version=11.0.0.0, Culture=neutral, PublicKeyToken=null from /config/plugins/Bookshelf_11.0.0.0/Jellyfin.Plugin.Bookshelf.dll
[07:55:02] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly Jellyfin.Plugin.CoverArtArchive, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null from /config/plugins/Cover Art Archive_8.0.0.0/Jellyfin.Plugin.CoverArtArchive.dll
[07:55:02] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly MetaBrainz.Common.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=be12cbb629c03021 from /config/plugins/Cover Art Archive_8.0.0.0/MetaBrainz.Common.Json.dll
[07:55:02] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly MetaBrainz.MusicBrainz.CoverArt, Version=6.0.0.0, Culture=neutral, PublicKeyToken=be12cbb629c03021 from /config/plugins/Cover Art Archive_8.0.0.0/MetaBrainz.MusicBrainz.CoverArt.dll
[07:55:02] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly Jellyfin.Plugin.Dlna, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null from /config/plugins/DLNA_3.0.0.0/Jellyfin.Plugin.Dlna.dll
[07:55:02] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly Jellyfin.Plugin.Dlna.Playback, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null from /config/plugins/DLNA_3.0.0.0/Jellyfin.Plugin.Dlna.Playback.dll
[07:55:02] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly Rssdp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null from /config/plugins/DLNA_3.0.0.0/Rssdp.dll
[07:55:02] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly Jellyfin.Plugin.Dlna.Model, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null from /config/plugins/DLNA_3.0.0.0/Jellyfin.Plugin.Dlna.Model.dll
[07:55:02] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly Jellyfin.Plugin.IMVDb, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null from /config/plugins/IMVDb_4.0.0.0/Jellyfin.Plugin.IMVDb.dll
[07:55:02] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly Jellyfin.Plugin.KodiSyncQueue, Version=11.0.0.0, Culture=neutral, PublicKeyToken=null from /config/plugins/Kodi Sync Queue_11.0.0.0/Jellyfin.Plugin.KodiSyncQueue.dll
[07:55:02] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly LiteDB, Version=5.0.15.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27 from /config/plugins/Kodi Sync Queue_11.0.0.0/LiteDB.dll
[07:55:02] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly Jellyfin.Plugin.LocalIntros, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null from /config/plugins/Local Intros_3.0.0.0/Jellyfin.Plugin.LocalIntros.dll
[07:55:02] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly Jellyfin.Plugin.NextPVR, Version=11.0.0.0, Culture=neutral, PublicKeyToken=null from /config/plugins/NextPVR_11.0.0.0/Jellyfin.Plugin.NextPVR.dll
[07:55:02] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly Jellyfin.Plugin.Opds, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null from /config/plugins/OPDS_5.0.0.0/Jellyfin.Plugin.Opds.dll
[07:55:02] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly Jellyfin.Plugin.OpenSubtitles, Version=20.0.0.0, Culture=neutral, PublicKeyToken=null from /config/plugins/Open Subtitles_20.0.0.0/Jellyfin.Plugin.OpenSubtitles.dll
[07:55:02] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly SQLitePCL.pretty, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null from /config/plugins/Playback Reporting_15.0.0.0/SQLitePCL.pretty.dll
[07:55:02] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly Jellyfin.Plugin.PlaybackReporting, Version=15.0.0.0, Culture=neutral, PublicKeyToken=null from /config/plugins/Playback Reporting_15.0.0.0/Jellyfin.Plugin.PlaybackReporting.dll
[07:55:02] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly ExcelNumberFormat, Version=1.1.0.0, Culture=neutral, PublicKeyToken=23c6f5d73be07eca from /config/plugins/Reports_17.0.0.0/ExcelNumberFormat.dll
[07:55:02] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly System.IO.Packaging, Version=4.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a from /config/plugins/Reports_17.0.0.0/System.IO.Packaging.dll
[07:55:03] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly DocumentFormat.OpenXml, Version=2.16.0.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17 from /config/plugins/Reports_17.0.0.0/DocumentFormat.OpenXml.dll
[07:55:03] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly SixLabors.Fonts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13 from /config/plugins/Reports_17.0.0.0/SixLabors.Fonts.dll
[07:55:03] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly ClosedXML, Version=0.97.0.0, Culture=neutral, PublicKeyToken=fd1eb21b62ae805b from /config/plugins/Reports_17.0.0.0/ClosedXML.dll
[07:55:03] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly Jellyfin.Plugin.Reports, Version=17.0.0.0, Culture=neutral, PublicKeyToken=null from /config/plugins/Reports_17.0.0.0/Jellyfin.Plugin.Reports.dll
[07:55:03] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly Jellyfin.Plugin.Tvdb, Version=15.0.0.0, Culture=neutral, PublicKeyToken=null from /config/plugins/TheTVDB_15.0.0.0/Jellyfin.Plugin.Tvdb.dll
[07:55:03] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly Tvdb.Sdk, Version=4.7.10.0, Culture=neutral, PublicKeyToken=null from /config/plugins/TheTVDB_15.0.0.0/Tvdb.Sdk.dll
[07:55:03] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly Jellyfin.Plugin.Vgmdb, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null from /config/plugins/VGMdb_4.0.0.0/Jellyfin.Plugin.Vgmdb.dll
[07:55:03] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly NYoutubeDLP, Version=0.12.1.0, Culture=neutral, PublicKeyToken=null from /config/plugins/YouTube Metadata_1.0.3.12/NYoutubeDLP.dll
[07:55:03] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly Jellyfin.Plugin.YoutubeMetadata, Version=1.0.3.12, Culture=neutral, PublicKeyToken=null from /config/plugins/YouTube Metadata_1.0.3.12/Jellyfin.Plugin.YoutubeMetadata.dll
[07:55:03] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly System.IO.Abstractions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=96bf224d23c43e59 from /config/plugins/YouTube Metadata_1.0.3.12/System.IO.Abstractions.dll
[07:55:03] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Defined LAN subnets: ["192.168.10.0/24", "fc00:10::/64"]
[07:55:03] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Defined LAN exclusions: []
[07:55:03] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Used LAN subnets: ["192.168.10.0/24", "fc00:10::/64"]
[07:55:03] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Filtered interface addresses: ["127.0.0.1", "10.88.0.1", "172.18.0.1", "172.21.0.1", "192.168.10.172", "172.22.0.1", "::1", "fe80::f4ad:b7ff:fe7e:5b1d%6", "fe80::42:faff:fe0c:102b%7", "fe80::42:e5ff:fe8b:e1b7%8", "fe80::28d6:63ff:feee:ec51%15", "fc00:10::3cd0:5dff:fec2:36e4", "fe80::3cd0:5dff:fec2:36e4%20", "fe80::42:1fff:fe46:9c65%45", "fe80::403:c8ff:fe7d:a46c%51", "fe80::6845:ffff:fe6d:25d5%53", "fe80::430:90ff:fef5:6c3f%55"]
[07:55:03] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Bind Addresses ["::"]
[07:55:03] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Remote IP filter is Allowlist
[07:55:03] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Filtered subnets: []
[07:55:07] [INF] [1] Microsoft.EntityFrameworkCore.Database.Command: Executed DbCommand (32ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
SELECT COUNT(*) FROM "sqlite_master" WHERE "name" = '__EFMigrationsHistory' AND "type" = 'table';
[07:55:07] [INF] [1] Microsoft.EntityFrameworkCore.Database.Command: Executed DbCommand (4ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
SELECT "MigrationId", "ProductVersion"
FROM "__EFMigrationsHistory"
ORDER BY "MigrationId";
[07:55:27] [INF] [1] Microsoft.EntityFrameworkCore.Database.Command: Executed DbCommand (2ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
SELECT "u"."Id", "u"."AudioLanguagePreference", "u"."AuthenticationProviderId", "u"."CastReceiverId", "u"."DisplayCollectionsView", "u"."DisplayMissingEpisodes", "u"."EnableAutoLogin", "u"."EnableLocalPassword", "u"."EnableNextEpisodeAutoPlay", "u"."EnableUserPreferenceAccess", "u"."HidePlayedInLatest", "u"."InternalId", "u"."InvalidLoginAttemptCount", "u"."LastActivityDate", "u"."LastLoginDate", "u"."LoginAttemptsBeforeLockout", "u"."MaxActiveSessions", "u"."MaxParentalAgeRating", "u"."MustUpdatePassword", "u"."Password", "u"."PasswordResetProviderId", "u"."PlayDefaultAudioTrack", "u"."RememberAudioSelections", "u"."RememberSubtitleSelections", "u"."RemoteClientBitrateLimit", "u"."RowVersion", "u"."SubtitleLanguagePreference", "u"."SubtitleMode", "u"."SyncPlayAccess", "u"."Username", "i"."Id", "i"."LastModified", "i"."Path", "i"."UserId"
FROM "Users" AS "u"
LEFT JOIN "ImageInfos" AS "i" ON "u"."Id" = "i"."UserId"
ORDER BY "u"."Id", "i"."Id"
[07:55:47] [INF] [1] Jellyfin.Plugin.NextPVR.RecordingsChannel: Cleaning JSON cache /cache/channels/76cccb8318c0b9f81429dd93ef7fb856/aa5f9808f2b91371eef8adfc2200ac27 0
[07:55:47] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: Bookshelf 11.0.0.0
[07:55:47] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: Cover Art Archive 8.0.0.0
[07:55:47] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: DLNA 3.0.0.0
[07:55:47] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: IMVDb 4.0.0.0
[07:55:47] [INF] [1] Jellyfin.Plugin.KodiSyncQueue.KodiSyncQueuePlugin: KodiSyncQueue is starting...
[07:55:47] [INF] [1] Jellyfin.Plugin.KodiSyncQueue.Data.DbRepo: Creating DB Repository...
[07:55:48] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: Kodi Sync Queue 11.0.0.0
[07:55:48] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: Local Intros 3.0.0.0
[07:55:48] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: NextPVR 11.0.0.0
[07:55:48] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: OPDS Feed 5.0.0.0
[07:55:48] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: Open Subtitles 20.0.0.0
[07:55:48] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: Playback Reporting 15.0.0.0
[07:55:48] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: Reports 17.0.0.0
[07:55:48] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: TheTVDB 15.0.0.0
[07:55:48] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: VGMdb 4.0.0.0
[07:55:48] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: YoutubeMetadata 1.0.3.12
[07:55:48] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: TMDb 10.9.11.0
[07:55:48] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: Studio Images 10.9.11.0
[07:55:48] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: OMDb 10.9.11.0
[07:55:48] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: MusicBrainz 10.9.11.0
[07:55:48] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: AudioDB 10.9.11.0
[07:55:48] [INF] [1] Jellyfin.Server.Migrations.MigrationRunner: Applying migration 'MigrateUserDatabase'
[07:55:48] [INF] [1] Jellyfin.Server.Migrations.Routines.MigrateUserDb: Migrating the user database may take a while, do not stop Jellyfin.
[07:55:48] [INF] [1] Microsoft.EntityFrameworkCore.Database.Command: Executed DbCommand (0ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
SELECT "u"."Id", "u"."AudioLanguagePreference", "u"."AuthenticationProviderId", "u"."CastReceiverId", "u"."DisplayCollectionsView", "u"."DisplayMissingEpisodes", "u"."EnableAutoLogin", "u"."EnableLocalPassword", "u"."EnableNextEpisodeAutoPlay", "u"."EnableUserPreferenceAccess", "u"."HidePlayedInLatest", "u"."InternalId", "u"."InvalidLoginAttemptCount", "u"."LastActivityDate", "u"."LastLoginDate", "u"."LoginAttemptsBeforeLockout", "u"."MaxActiveSessions", "u"."MaxParentalAgeRating", "u"."MustUpdatePassword", "u"."Password", "u"."PasswordResetProviderId", "u"."PlayDefaultAudioTrack", "u"."RememberAudioSelections", "u"."RememberSubtitleSelections", "u"."RemoteClientBitrateLimit", "u"."RowVersion", "u"."SubtitleLanguagePreference", "u"."SubtitleMode", "u"."SyncPlayAccess", "u"."Username"
FROM "Users" AS "u"
[07:55:48] [ERR] [1] Jellyfin.Server.Migrations.MigrationRunner: Could not apply migration 'MigrateUserDatabase'
System.InvalidOperationException: There was an error reflecting type 'MediaBrowser.Model.Users.UserPolicy'.
---> System.InvalidOperationException: Cannot serialize member 'MediaBrowser.Model.Users.UserPolicy.AccessSchedules' of type 'Jellyfin.Data.Entities.AccessSchedule[]', see inner exception for more details.
---> System.InvalidOperationException: Jellyfin.Data.Entities.AccessSchedule cannot be serialized because it does not have a parameterless constructor.
  --- End of inner exception stack trace ---
  at System.Xml.Serialization.StructModel.CheckSupportedMember(TypeDesc typeDesc, MemberInfo member, Type type)
  at System.Xml.Serialization.StructModel.GetPropertyModel(PropertyInfo propertyInfo)
  at System.Xml.Serialization.StructModel.GetFieldModel(MemberInfo memberInfo)
  at System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter)
  at System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter)
  at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter)
  --- End of inner exception stack trace ---
  at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter)
  at System.Xml.Serialization.XmlReflectionImporter.ImportElement(TypeModel model, XmlRootAttribute root, String defaultNamespace, RecursionLimiter limiter)
  at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(Type type, XmlRootAttribute root, String defaultNamespace)
  at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)
  at Emby.Server.Implementations.Serialization.MyXmlSerializer.<>c.<GetSerializer>b__1_0(String _, Type t)
  at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd[TArg](TKey key, Func`3 valueFactory, TArg factoryArgument)
  at Emby.Server.Implementations.Serialization.MyXmlSerializer.GetSerializer(Type type)
  at Emby.Server.Implementations.Serialization.MyXmlSerializer.DeserializeFromStream(Type type, Stream stream)
  at Emby.Server.Implementations.Serialization.MyXmlSerializer.DeserializeFromFile(Type type, String file)
  at Jellyfin.Server.Migrations.Routines.MigrateUserDb.Perform()
  at Jellyfin.Server.Migrations.MigrationRunner.PerformMigrations(IMigrationRoutine[] migrations, MigrationOptions migrationOptions, Action`1 saveConfiguration, ILogger logger)
[07:55:48] [FTL] [1] Main: Error while starting server
System.InvalidOperationException: There was an error reflecting type 'MediaBrowser.Model.Users.UserPolicy'.
---> System.InvalidOperationException: Cannot serialize member 'MediaBrowser.Model.Users.UserPolicy.AccessSchedules' of type 'Jellyfin.Data.Entities.AccessSchedule[]', see inner exception for more details.
---> System.InvalidOperationException: Jellyfin.Data.Entities.AccessSchedule cannot be serialized because it does not have a parameterless constructor.
  --- End of inner exception stack trace ---
  at System.Xml.Serialization.StructModel.CheckSupportedMember(TypeDesc typeDesc, MemberInfo member, Type type)
  at System.Xml.Serialization.StructModel.GetPropertyModel(PropertyInfo propertyInfo)
  at System.Xml.Serialization.StructModel.GetFieldModel(MemberInfo memberInfo)
  at System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter)
  at System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter)
  at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter)
  --- End of inner exception stack trace ---
  at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter)
  at System.Xml.Serialization.XmlReflectionImporter.ImportElement(TypeModel model, XmlRootAttribute root, String defaultNamespace, RecursionLimiter limiter)
  at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(Type type, XmlRootAttribute root, String defaultNamespace)
  at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)
  at Emby.Server.Implementations.Serialization.MyXmlSerializer.<>c.<GetSerializer>b__1_0(String _, Type t)
  at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd[TArg](TKey key, Func`3 valueFactory, TArg factoryArgument)
  at Emby.Server.Implementations.Serialization.MyXmlSerializer.GetSerializer(Type type)
  at Emby.Server.Implementations.Serialization.MyXmlSerializer.DeserializeFromStream(Type type, Stream stream)
  at Emby.Server.Implementations.Serialization.MyXmlSerializer.DeserializeFromFile(Type type, String file)
  at Jellyfin.Server.Migrations.Routines.MigrateUserDb.Perform()
  at Jellyfin.Server.Migrations.MigrationRunner.PerformMigrations(IMigrationRoutine[] migrations, MigrationOptions migrationOptions, Action`1 saveConfiguration, ILogger logger)
  at Jellyfin.Server.Migrations.MigrationRunner.Run(CoreAppHost host, ILoggerFactory loggerFactory)
  at Jellyfin.Server.Program.StartServer(IServerApplicationPaths appPaths, StartupOptions options, IConfiguration startupConfig)
[07:55:48] [INF] [1] Main: Running query planner optimizations in the database... This might take a while
[07:55:48] [INF] [1] Microsoft.EntityFrameworkCore.Database.Command: Executed DbCommand (5ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
PRAGMA optimize
[07:55:48] [INF] [1] Emby.Server.Implementations.ApplicationHost: Disposing CoreAppHost
[07:55:48] [INF] [1] Emby.Server.Implementations.ApplicationHost: Disposing MusicBrainzArtistProvider
[07:55:48] [INF] [1] Emby.Server.Implementations.ApplicationHost: Disposing MusicBrainzAlbumProvider
[07:55:48] [INF] [1] Emby.Server.Implementations.ApplicationHost: Disposing CoverArtArchiveImageProvider
[07:55:48] [INF] [1] Emby.Server.Implementations.ApplicationHost: Disposing KodiSyncQueuePlugin
[07:55:48] [INF] [1] Emby.Server.Implementations.ApplicationHost: Disposing PluginManager



RE: MigrateUserDatabase always fails - TheDreadPirate - 2024-10-13

What exactly are you trying to do here? Migrations only need to happen when upgrading Jellyfin, and only once.


RE: MigrateUserDatabase always fails - prahal - 2024-10-29

I followed a piece of advice on this forum to delete migrations.xml (thus redo all the migration).

I lost the ability to login.
I restore the jellyfin db from backup and I got back the ability to login.
Then I lost this ability again (probably ran the migration again).
So I checked my jellyfin.db and the backup and the Users table was empty. I don't know how I got the ability to login back after restoring as there was no Users table entries even then. I did not investigate (maybe the migration removed a flag that was making jellyfin read the old users.db database file, that would require more work.

So I believe that somehow the UserDb migration had not run succeessfullyon my jellyfin install and that running it partially broke the ability to authenticate.


Either way I found that it was enough to add back:

+ /// <summary>
+ /// Initializes a new instance of the <see cref="AccessSchedule"/> class.
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </summary>
+ protected AccessSchedule()
+ {
+ }

in Jellyfin.Data/Entities/AccessSchedule.cs b/Jellyfin.Data/Entities/AccessSchedule.cs

this code was removed with a lot of other parameterless constructors in commit 287dab465.
I believe that if the Jellyfin.Server/Migrations/Routines/MigrateUserDb.cs code is kept then it should be able to run which is not the case without this AccessSchedule parameterless constructor.

Do you mean I should not submit a PR and have this routine working again? (it cannot run currently) Because it is not supposed to run on installs that are up to date?
Shouldn't this MigrateUserDb.cs code be removed if it is not supposed to run and fixing its breakage is not seen as of use?


RE: MigrateUserDatabase always fails - TheDreadPirate - 2024-10-29

How big of a version jump was your upgrade? Depending on what version you were at and what version you were going to, there were some migrations that took a long time. If the migration was interrupted, that may have corrupted your database.

If you still have your backup you can stop jellyfin, restore it again, start it and then share the new log via pastebin.


RE: MigrateUserDatabase always fails - prahal - 2024-12-05

(2024-10-29, 12:25 AM)prahal Wrote: I followed a piece of advice on this forum to delete migrations.xml (thus redo all the migration).

I lost the ability to login.
I restore the jellyfin db from backup and I got back the ability to login.
Then I lost this ability again (probably ran the migration again).
So I checked my jellyfin.db and the backup and the Users table was empty. I don't know how I got the ability to login back after restoring as there was no Users table entries even then. I did not investigate (maybe the migration removed a flag that was making jellyfin read the old users.db database file, that would require more work.

So I believe that somehow the UserDb migration had not run succeessfullyon my jellyfin install and that running it partially broke the ability to authenticate.


Either way I found that it was enough to add back:

+        /// <summary>
+        /// Initializes a new instance of the <see cref="AccessSchedule"/> class.
+        /// Default constructor. Protected due to required properties, but present because EF needs it.
+        /// </summary>
+        protected AccessSchedule()
+        {
+        }

in Jellyfin.Data/Entities/AccessSchedule.cs b/Jellyfin.Data/Entities/AccessSchedule.cs

this code was removed with a lot of other parameterless constructors in commit 287dab465.
I believe that if the Jellyfin.Server/Migrations/Routines/MigrateUserDb.cs code is kept then it should be able to run which is not the case without this AccessSchedule parameterless constructor.

Do you mean I should not submit a PR and have this routine working again? (it cannot run currently) Because it is not supposed to run on installs that are up to date?
Shouldn't this MigrateUserDb.cs code be removed if it is not supposed to run and fixing its breakage is not seen as of use?

THe issue is that was not my question. I did not ask how to restore jellyfin to a usable state. My question was "is the fact taht MigrateUserDatabase in the jellyfin code cannot work (in no way can it run without crashing on the missing constructor) a bug" ? That is is having even old migration code that do not work a bug in jellyfin ?
Shouldn't the non supported because too old migration code be removed if it is not expected to be able to run without crashing ? Or should I report the issue to github so as to have the MigrateUserDatabase be fixed ?
I am not asking how to get my DB into a usable state. I am asking if I should open a bug report for code that cannot work but is shipped by the current jellyfin release.

Also if old migration should never be attempted again, people telling to delete config/migrations.xml should stop telling so because this triggers the old migration code that is broken currently and that you seem to tell me should not be brought into a working state again because it is deprecated code that no one should run.