Jellyfin Forum
SOLVED: Media scanning failing, and unable to use migration fix - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: Troubleshooting (https://forum.jellyfin.org/f-troubleshooting)
+---- Forum: Media Scanning & Identification (https://forum.jellyfin.org/f-media-scanning-identification)
+---- Thread: SOLVED: Media scanning failing, and unable to use migration fix (/t-solved-media-scanning-failing-and-unable-to-use-migration-fix)

Pages: 1 2


Media scanning failing, and unable to use migration fix - Noneuclidery - 2024-09-02

I've seen a lot of people with this error:

Code:
[2024-09-02 13:04:29.474 +10:00] [ERR] Error executing Scheduled Task
System.InvalidOperationException: The data is NULL at ordinal 1. This method can't be called on NULL values. Check using IsDBNull before calling.
  at Microsoft.Data.Sqlite.SqliteDataRecord.GetNull[T](Int32 ordinal)
  at Microsoft.Data.Sqlite.SqliteValueReader.GetBlob(Int32 ordinal)
  at Microsoft.Data.Sqlite.SqliteDataRecord.GetBlob(Int32 ordinal)
  at Microsoft.Data.Sqlite.SqliteDataRecord.GetCachedBlob(Int32 ordinal)
  at Microsoft.Data.Sqlite.SqliteDataRecord.GetStream(Int32 ordinal)
  at Microsoft.Data.Sqlite.SqliteDataReader.GetStream(Int32 ordinal)
  at Emby.Server.Implementations.Data.SqliteItemRepository.GetItem(SqliteDataReader reader, InternalItemsQuery query, Boolean enableProgramAttributes, Boolean hasEpisodeAttributes, Boolean hasServiceName, Boolean queryHasStartDate, Boolean hasTrailerTypes, Boolean hasArtistFields, Boolean hasSeriesFields, Boolean skipDeserialization)
  at Emby.Server.Implementations.Data.SqliteItemRepository.GetItemList(InternalItemsQuery query)
  at MediaBrowser.Controller.Entities.Folder.GetCachedChildren()
  at MediaBrowser.Controller.Entities.Folder.LoadChildren()
  at MediaBrowser.Controller.Entities.Folder.get_Children()
  at MediaBrowser.Controller.Entities.Audio.MusicArtist.get_Children()
  at MediaBrowser.Controller.Entities.Folder.GetActualChildrenDictionary()
  at MediaBrowser.Controller.Entities.Folder.ValidateChildrenInternal2(IProgress`1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
  at MediaBrowser.Controller.Entities.Folder.ValidateChildrenInternal(IProgress`1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
  at MediaBrowser.Controller.Entities.Folder.<>c__DisplayClass69_0`1.<<RunTasks>b__1>d.MoveNext()
--- End of stack trace from previous location ---
  at MediaBrowser.Controller.Entities.Folder.RunTasks[T](Func`3 task, IList`1 children, IProgress`1 progress, CancellationToken cancellationToken)
  at MediaBrowser.Controller.Entities.Folder.ValidateChildrenInternal2(IProgress`1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
  at MediaBrowser.Controller.Entities.Folder.ValidateChildrenInternal(IProgress`1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
  at MediaBrowser.Controller.Entities.Folder.<>c__DisplayClass69_0`1.<<RunTasks>b__1>d.MoveNext()
--- End of stack trace from previous location ---
  at MediaBrowser.Controller.Entities.Folder.RunTasks[T](Func`3 task, IList`1 children, IProgress`1 progress, CancellationToken cancellationToken)
  at MediaBrowser.Controller.Entities.Folder.ValidateChildrenInternal2(IProgress`1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
  at MediaBrowser.Controller.Entities.Folder.ValidateChildrenInternal(IProgress`1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
  at MediaBrowser.Controller.Entities.AggregateFolder.ValidateChildrenInternal(IProgress`1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
  at Emby.Server.Implementations.Library.LibraryManager.PerformLibraryValidation(IProgress`1 progress, CancellationToken cancellationToken)
  at Emby.Server.Implementations.Library.LibraryManager.ValidateMediaLibraryInternal(IProgress`1 progress, CancellationToken cancellationToken)
  at Emby.Server.Implementations.ScheduledTasks.ScheduledTaskWorker.ExecuteInternal(TaskOptions options)
[2024-09-02 13:04:29.475 +10:00] [INF] "Scan Media Library" Failed after 0 minute(s) and 0 seconds

Or this one:

Code:
[2024-09-02 13:04:35.590 +10:00] [ERR] Error processing request. URL "GET" "/Users/f9a836173a0d47d3b404533f7282e33a/Items/Latest".
System.InvalidOperationException: The data is NULL at ordinal 1. This method can't be called on NULL values. Check using IsDBNull before calling.
  at Microsoft.Data.Sqlite.SqliteDataRecord.GetNull[T](Int32 ordinal)
  at Microsoft.Data.Sqlite.SqliteValueReader.GetBlob(Int32 ordinal)
  at Microsoft.Data.Sqlite.SqliteDataRecord.GetCachedBlob(Int32 ordinal)
  at Microsoft.Data.Sqlite.SqliteDataRecord.GetStream(Int32 ordinal)
  at Emby.Server.Implementations.Data.SqliteItemRepository.GetItem(SqliteDataReader reader, InternalItemsQuery query, Boolean enableProgramAttributes, Boolean hasEpisodeAttributes, Boolean hasServiceName, Boolean queryHasStartDate, Boolean hasTrailerTypes, Boolean hasArtistFields, Boolean hasSeriesFields, Boolean skipDeserialization)
  at Emby.Server.Implementations.Data.SqliteItemRepository.GetItemList(InternalItemsQuery query)
  at Emby.Server.Implementations.Library.LibraryManager.GetItemList(InternalItemsQuery query, List`1 parents)
  at Emby.Server.Implementations.Library.UserViewManager.GetItemsForLatestItems(User user, LatestItemsQuery request, DtoOptions options)
  at Emby.Server.Implementations.Library.UserViewManager.GetLatestItems(LatestItemsQuery request, DtoOptions options)
  at Jellyfin.Api.Controllers.UserLibraryController.GetLatestMedia(Nullable`1 userId, Nullable`1 parentId, ItemFields[] fields, BaseItemKind[] includeItemTypes, Nullable`1 isPlayed, Nullable`1 enableImages, Nullable`1 imageTypeLimit, ImageType[] enableImageTypes, Nullable`1 enableUserData, Int32 limit, Boolean groupItems)
  at lambda_method849(Closure, Object, Object[])
  at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
  at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
--- End of stack trace from previous location ---
  at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
  at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
  at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
  at Jellyfin.Api.Middleware.ServerStartupMessageMiddleware.Invoke(HttpContext httpContext, IServerApplicationHost serverApplicationHost, ILocalizationManager localizationManager)
  at Jellyfin.Api.Middleware.WebSocketHandlerMiddleware.Invoke(HttpContext httpContext, IWebSocketManager webSocketManager)
  at Jellyfin.Api.Middleware.IPBasedAccessValidationMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager)
  at Jellyfin.Api.Middleware.LanFilteringMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager)
  at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
  at Jellyfin.Api.Middleware.QueryStringDecodingMiddleware.Invoke(HttpContext httpContext)
  at Swashbuckle.AspNetCore.ReDoc.ReDocMiddleware.Invoke(HttpContext httpContext)
  at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
  at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
  at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
  at Jellyfin.Api.Middleware.RobotsRedirectionMiddleware.Invoke(HttpContext httpContext)
  at Jellyfin.Api.Middleware.LegacyEmbyRouteRewriteMiddleware.Invoke(HttpContext httpContext)
  at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context)
  at Jellyfin.Api.Middleware.ResponseTimeMiddleware.Invoke(HttpContext context, IServerConfigurationManager serverConfigurationManager)
  at Jellyfin.Api.Middleware.ExceptionMiddleware.Invoke(HttpContext context)

And the fix is always

Quote:Stop Jellyfin, remove the entry below from your migrations.xml in the config folder and restart Jellyfin. Wait until the migration completes;
Code:
    <ValueTupleOfGuidString>
      <Item1>cf6fabc2-9fbe-4933-84a5-ffe52ef22a58</Item1>
      <Item2>FixAudioData</Item2>
    </ValueTupleOfGuidString>

But my migrations file does not have that entry. In fact, the migrations.xml in my user config hasn't been modified since November last year. What does that mean? What should I do now?

Server version: 10.9.9
OS: Arch Linux
Not a docker image. Installed by package manager and run by systemd for the last couple of years, with regular computer restarts.


RE: Media scanning failing, and unable to use migration fix - TheDreadPirate - 2024-09-02

Rename migrations.xml and restart jellyfin.


RE: Media scanning failing, and unable to use migration fix - Noneuclidery - 2024-09-02

Hmm, it did not try to recreate it. What would have changed since November to make it stop using that file?

... Actually, that's shortly before I became homeless for six months and had to move my computer to someone else's network, but I'm not sure why that would affect it.


RE: Media scanning failing, and unable to use migration fix - TheDreadPirate - 2024-09-02

What OS is your server running? If Linux, how are you stopping and starting Jellyfin?


RE: Media scanning failing, and unable to use migration fix - Noneuclidery - 2024-09-02

It's running on my desktop, which is ArchLinux, and only connected locally (not accessible from outside the local network). The server is running on systemd at startup, and I'm stopping and starting it with commands like sudo systemctl start jellyfin.service.


RE: Media scanning failing, and unable to use migration fix - TheDreadPirate - 2024-09-02

Run this command and copy and paste the output to pastebin.

Code:
sudo journalctl -u jellyfin -n 200 --no-pager



RE: Media scanning failing, and unable to use migration fix - Noneuclidery - 2024-09-02

https://pastebin.com/ne7TDquu

(There are a few logs of my housemate watching something, but I have warned zem I might need to restart the server again. XD )


RE: Media scanning failing, and unable to use migration fix - TheDreadPirate - 2024-09-02

Unfortunately, your database is likely broken.


RE: Media scanning failing, and unable to use migration fix - Noneuclidery - 2024-09-03

Ah. Damn.

... So is that a reinstall? Can I keep my posters and such (I chose custom posters for everything) while recreating the database? How can I avoid this in the future?


RE: Media scanning failing, and unable to use migration fix - TheDreadPirate - 2024-09-03

You don't have to reinstall, but you will need to clear out /var/lib/jellyfin.

Code:
sudo systemctl stop jellyfin
sudo mv /var/lib/jellyfin /var/lib/origJellyfin
sudo mkdir /var/lib/jellyfin
sudo chown jellyfin: /var/lib/jellyfin
sudo systemctl start jellyfin

If the posters are saved in your media directory, you can reuse them. If not, you'll have to start over.

You have a couple options to help preserve any customized metadata.

1) Enable NFO saver and/or enable saving of images to the media directory in the library settings.
2) Create a cronjob to backup Jellyfin's data directory.