Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library Fails to Scan due to System.InvalidOperationException error #11605

Closed
1 task done
mlclns opened this issue May 13, 2024 · 13 comments
Closed
1 task done

Library Fails to Scan due to System.InvalidOperationException error #11605

mlclns opened this issue May 13, 2024 · 13 comments
Assignees
Labels
bug Something isn't working

Comments

@mlclns
Copy link

mlclns commented May 13, 2024

Please describe your bug

After implementing the suggestion from #11589, I was able to get past a 'database is locked' issue I had, however, I am still unable to complete a library scan due to the issue listed below and in the logs:

System.InvalidOperationException: Must add values for the following parameters: @Type2, @Value2, @CleanValue2

Reproduction Steps

Upgrade a 10.9.0 linuxserver/jellyfin container to 10.9.1 by docker compose pull && docker compose down && docker compose up -d to recreate the containers. Upon doing so, waiting for the service to start up, and setting parallel scan to 1 (as opposed to 0), completing a library scan will be impossible due to this error captured in the logs every time. My docker-compose.yml has the environment variable JELLYFIN_playlists:allowDuplicates=false, and the following mounts:

    volumes:
      - ./library:/config
      - /mnt/media1/media/Music:/data/music:ro
      - /mnt/media1/media/Anime:/data/anime:ro
      - /mnt/media2/media/Anime:/data/anime2:ro
      - /mnt/media1/media/TV:/data/tv:ro
      - /mnt/media2/media/TV:/data/tv2:ro
      - /mnt/media1/media/Movies:/data/movies:ro
      - /mnt/media2/media/Movies:/data/movies2:ro
      - /mnt/media1/media/YouTube:/data/youtube:ro
      - ./woff2:/data/fonts

Jellyfin Version

10.9.0

if other:

10.9.1

Environment

- OS: Fedora 37
- Linux Kernel: 6.4.6
- Virtualization: Docker
- Clients: Browser
- Browser: Firefox 125.0.3
- FFmpeg Version: N/A
- Playback Method: N/A
- Hardware Acceleration: Intel Quicksync
- GPU Model: Intel® UHD Graphics 630
- Plugins: AudioDB, Kodi Sync Queue, MusicBrainz, OMDb, Playback Reporting Status Activity, Studio Images, TMDb
- Reverse Proxy: SWAG
- Base URL: play.mydomain.tld
- Networking: Ports passed through to host
- Storage: Seagate Ironwolf 10TB

Jellyfin logs

[2024-05-13 02:52:16.204 -04:00] [ERR] [29] Emby.Server.Implementations.ScheduledTasks.TaskManager: Error executing Scheduled Task
System.InvalidOperationException: Must add values for the following parameters: @Type2, @Value2, @CleanValue2
   at Microsoft.Data.Sqlite.SqliteCommand.GetStatements()+MoveNext()
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
   at Emby.Server.Implementations.Data.SqliteItemRepository.InsertItemValues(Guid id, List`1 values, SqliteConnection db)
   at Emby.Server.Implementations.Data.SqliteItemRepository.UpdateItemValues(Guid itemId, List`1 values, SqliteConnection db)
   at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItemsInTransaction(SqliteConnection db, IEnumerable`1 tuples)
   at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItems(IReadOnlyList`1 items, CancellationToken cancellationToken)
   at Emby.Server.Implementations.Library.LibraryManager.UpdateItemsAsync(IReadOnlyList`1 items, BaseItem parent, ItemUpdateType updateReason, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.MetadataService`2.SaveItemAsync(MetadataResult`1 result, ItemUpdateType reason, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.MetadataService`2.RefreshMetadata(BaseItem item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.BaseItem.RefreshMetadata(MetadataRefreshOptions options, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Audio.MusicAlbum.RefreshAllMetadata(MetadataRefreshOptions refreshOptions, IProgress`1 progress, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Folder.RefreshAllMetadataForContainer(IMetadataContainer container, MetadataRefreshOptions refreshOptions, IProgress`1 progress, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Folder.RefreshChildMetadata(BaseItem child, MetadataRefreshOptions refreshOptions, Boolean recursive, IProgress`1 progress, 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.RefreshChildMetadata(BaseItem child, MetadataRefreshOptions refreshOptions, Boolean recursive, IProgress`1 progress, 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.RefreshChildMetadata(BaseItem child, MetadataRefreshOptions refreshOptions, Boolean recursive, IProgress`1 progress, 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-05-13 02:52:16.205 -04:00] [INF] [29] Emby.Server.Implementations.ScheduledTasks.TaskManager: "Scan Media Library" Failed after 5 minute(s) and 11 seconds

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
@mlclns mlclns added the bug Something isn't working label May 13, 2024
@jellyfin-bot
Copy link
Contributor

Hi, it seems like your issue report has the following item(s) that need to be addressed:

  • The title of this issue report is empty. Please change it to something descriptive.

This is an automated message, currently under testing. Please file an issue here if you encounter any problems.

@mlclns mlclns changed the title [Issue]: Library Fails to Scan due to System.InvalidOperationException error May 13, 2024
@epolinom
Copy link

I encountered exactly the same problem,
System.InvalidOperationException: Must add values for the following parameters:

@Vextryyn
Copy link

Vextryyn commented May 15, 2024

Issue is that it isnt saving the XML when you change add or remove paths to your libraries. Now if you have a path that no longer exists it breaks the scan.

I had to do this:
Go to:
C:\Users*****\AppData\Local\jellyfin\root\default\

you will have a folder for each library you have and find Options.xml
go to the library folders and delete any unused paths you may have in the Options XML
This is what mine looked like:


Z:\Vex Videos\Anime


V:\Vex\Anime


W:\Vex\Anime

W no longer existed and it wouldnt let me add or delete from the client so I had to manually edit the XML, I deleted the path that no longer existed.

I deletetd this:

W:\Vex\Anime

Final view of the segment is now:

Z:\Vex Videos\Anime V:\Vex\Anime

Once all the broken paths were removed everything worked as normal

Edit: I'm starting to think my error is different, but it's worth a shot if you have any external drives that are unplugged.

@advert665
Copy link

advert665 commented May 15, 2024

I'm also having this issue on a fresh install with a music library of about 1200 albums.
Emby.Server.Implementations.ScheduledTasks.TaskManager: Error executing Scheduled Task System.InvalidOperationException: Must add values for the following parameters: @Type2, @Value2, @CleanValue2

@mlclns
Copy link
Author

mlclns commented May 16, 2024

Issue is that it isnt saving the XML when you change add or remove paths to your libraries. Now if you have a path that no longer exists it breaks the scan.

I had to do this: Go to: C:\Users*****\AppData\Local\jellyfin\root\default\

you will have a folder for each library you have and find Options.xml go to the library folders and delete any unused paths you may have in the Options XML This is what mine looked like: Z:\Vex Videos\Anime V:\Vex\Anime W:\Vex\Anime

W no longer existed and it wouldnt let me add or delete from the client so I had to manually edit the XML, I deleted the path that no longer existed.

I deletetd this: W:\Vex\Anime

Final view of the segment is now:
Z:\Vex Videos\Anime V:\Vex\Anime

Once all the broken paths were removed everything worked as normal

Edit: I'm starting to think my error is different, but it's worth a shot if you have any external drives that are unplugged.

Unfortunately this wasn't the issue on my end, though I thought for a second it might be the Metadata plugins listed on that file that I had removed, but I readded the plugins to no avail.

@mlclns
Copy link
Author

mlclns commented May 16, 2024

Wait, I just spun up a new instance of Jellyfin, and am having the same issue. This is with the jellyfin/jellyfin image. Is it possible Jellyfin is trying to modify my media directories (and if so, why)? Cause I have all my media folder mounts as read-only (a precaution so nothing like the lyric files getting overwritten bug ever happens).

@mlclns
Copy link
Author

mlclns commented May 16, 2024

Ok, upon further testing and adding/removing libraries one by one in this instance, I was able to localize the issue to my Music library. Here is some additional context to the bug:

[2024-05-16 18:45:40.967 +00:00] [ERR] [63] MediaBrowser.Providers.Music.AudioMetadataService: Error in "Image Extractor"
MediaBrowser.Common.FfmpegException: ffmpeg image extraction failed for file:"/music/The Black Keys/El Camino (Australia Tour Edition Deluxe Edition)/01-04 • Little Black Submarines.m4a"
   at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.ExtractImageInternal(String inputPath, String container, MediaStream videoStream, Nullable`1 imageStreamIndex, Nullable`1 threedFormat, Nullable`1 offset, Boolean useIFrame, Nullable`1 targetFormat, CancellationToken cancellationToken)
   at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.ExtractImage(String inputFile, String container, MediaStream videoStream, Nullable`1 imageStreamIndex, MediaSourceInfo mediaSource, Boolean isAudio, Nullable`1 threedFormat, Nullable`1 offset, Nullable`1 targetFormat, CancellationToken cancellationToken)
   at MediaBrowser.Providers.MediaInfo.AudioImageProvider.GetImage(Audio item, List`1 imageStreams, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.ItemImageProvider.RefreshFromProvider(BaseItem item, IDynamicImageProvider provider, ImageRefreshOptions refreshOptions, TypeOptions savedOptions, List`1 downloadedImages, RefreshResult result, CancellationToken cancellationToken)
[2024-05-16 18:45:42.554 +00:00] [INF] [109] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Starting "/usr/lib/jellyfin-ffmpeg/ffprobe" with args "-analyzeduration 200M -probesize 1G -i file:\"/music/sped up 8282/Cupid – Twin Ver. (FIFTY FIFTY) – Sped Up Version/01-01 • Cupid – Twin Ver. (FIFTY FIFTY) – Sped Up Version.flac\" -threads 0 -v warning -print_format json -show_streams -show_format"
[2024-05-16 18:45:45.730 +00:00] [INF] [17] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Starting "/usr/lib/jellyfin-ffmpeg/ffprobe" with args "-analyzeduration 200M -probesize 1G -i file:\"/music/sumika/Fiction e.p/01-01 • フィクション.mp3\" -threads 0 -v warning -print_format json -show_streams -show_format"
[2024-05-16 18:45:45.730 +00:00] [INF] [25] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Starting "/usr/lib/jellyfin-ffmpeg/ffprobe" with args "-analyzeduration 200M -probesize 1G -i file:\"/music/sumika/ファンファーレ/01-01 • ファンファーレ.mp3\" -threads 0 -v warning -print_format json -show_streams -show_format"
[2024-05-16 18:45:46.027 +00:00] [INF] [17] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Starting "/usr/lib/jellyfin-ffmpeg/ffprobe" with args "-analyzeduration 200M -probesize 1G -i file:\"/music/sumika/ファンファーレ/01-02 • 春夏秋冬.mp3\" -threads 0 -v warning -print_format json -show_streams -show_format"
[2024-05-16 18:45:50.091 +00:00] [ERR] [87] Emby.Server.Implementations.ScheduledTasks.TaskManager: Error executing Scheduled Task
System.InvalidOperationException: Must add values for the following parameters: @Type2, @Value2, @CleanValue2
   at Microsoft.Data.Sqlite.SqliteCommand.GetStatements()+MoveNext()
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
   at Emby.Server.Implementations.Data.SqliteItemRepository.InsertItemValues(Guid id, List`1 values, SqliteConnection db)
   at Emby.Server.Implementations.Data.SqliteItemRepository.UpdateItemValues(Guid itemId, List`1 values, SqliteConnection db)
   at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItemsInTransaction(SqliteConnection db, IEnumerable`1 tuples)
   at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItems(IReadOnlyList`1 items, CancellationToken cancellationToken)
   at Emby.Server.Implementations.Library.LibraryManager.UpdateItemsAsync(IReadOnlyList`1 items, BaseItem parent, ItemUpdateType updateReason, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.MetadataService`2.SaveItemAsync(MetadataResult`1 result, ItemUpdateType reason, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.MetadataService`2.RefreshMetadata(BaseItem item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.BaseItem.RefreshMetadata(MetadataRefreshOptions options, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Audio.MusicAlbum.RefreshAllMetadata(MetadataRefreshOptions refreshOptions, IProgress`1 progress, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Folder.RefreshAllMetadataForContainer(IMetadataContainer container, MetadataRefreshOptions refreshOptions, IProgress`1 progress, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Folder.RefreshChildMetadata(BaseItem child, MetadataRefreshOptions refreshOptions, Boolean recursive, IProgress`1 progress, 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.RefreshChildMetadata(BaseItem child, MetadataRefreshOptions refreshOptions, Boolean recursive, IProgress`1 progress, 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.RefreshChildMetadata(BaseItem child, MetadataRefreshOptions refreshOptions, Boolean recursive, IProgress`1 progress, 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-05-16 18:45:50.091 +00:00] [INF] [87] Emby.Server.Implementations.ScheduledTasks.TaskManager: "Scan Media Library" Failed after 8 minute(s) and 54 seconds

And here is the settings for that library (But LUFS was enabled in that scan, attempting without it right now (Edit: failed with LUFS disabled as well)):
Screenshot 2024-05-16 at 14 51 08

Edit 2: Same issue when disabling Image Extractor

@wlt-cortex
Copy link

same error here. The music library scan always trigger this error:

warning -print_format json -show_streams -show_format
[03:10:47] [INF] [40] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Starting /usr/lib/jellyfin-ffmpeg/ffprobe with args -analyzeduration 200M -probesize 1G -i file:"/media/Music/许嵩/单曲/许嵩 - 绝代风华.flac" -threads 0 -v warning -print_format json -show_streams -show_format
[03:11:08] [ERR] [40] Emby.Server.Implementations.ScheduledTasks.TaskManager: Error executing Scheduled Task
System.InvalidOperationException: Must add values for the following parameters: @Type2, @Value2, @CleanValue2
   at Microsoft.Data.Sqlite.SqliteCommand.GetStatements()+MoveNext()
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
   at Emby.Server.Implementations.Data.SqliteItemRepository.InsertItemValues(Guid id, List`1 values, SqliteConnection db)
   at Emby.Server.Implementations.Data.SqliteItemRepository.UpdateItemValues(Guid itemId, List`1 values, SqliteConnection db)
   at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItemsInTransaction(SqliteConnection db, IEnumerable`1 tuples)
   at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItems(IReadOnlyList`1 items, CancellationToken cancellationToken)
   at Emby.Server.Implementations.Library.LibraryManager.UpdateItemsAsync(IReadOnlyList`1 items, BaseItem parent, ItemUpdateType updateReason, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.MetadataService`2.SaveItemAsync(MetadataResult`1 result, ItemUpdateType reason, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.MetadataService`2.RefreshMetadata(BaseItem item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.BaseItem.RefreshMetadata(MetadataRefreshOptions options, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Audio.MusicAlbum.RefreshAllMetadata(MetadataRefreshOptions refreshOptions, IProgress`1 progress, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Folder.RefreshAllMetadataForContainer(IMetadataContainer container, MetadataRefreshOptions refreshOptions, IProgress`1 progress, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Folder.RefreshChildMetadata(BaseItem child, MetadataRefreshOptions refreshOptions, Boolean recursive, IProgress`1 progress, 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.RefreshChildMetadata(BaseItem child, MetadataRefreshOptions refreshOptions, Boolean recursive, IProgress`1 progress, 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.RefreshChildMetadata(BaseItem child, MetadataRefreshOptions refreshOptions, Boolean recursive, IProgress`1 progress, 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)
[03:11:08] [INF] [40] Emby.Server.Implementations.ScheduledTasks.TaskManager: 扫描媒体库 Failed after 0 minute(s) and 26 seconds
[03:11:16] [INF] [20] Emby.Server.Implementations.ScheduledTasks.TaskManager: Webhook Item Added Notifier Completed after 0 minute(s) and 0 seconds

And i have checked the file: /media/Music/许嵩/单曲/许嵩 - 绝代风华.flac exists in docker.

@mlclns
Copy link
Author

mlclns commented May 17, 2024

I wonder if there's a bug in the version of jellyfin-ffmpeg bundled with this docker image, given the MediaBrowser.Common.FfmpegException: ffmpeg image extraction failed for file

@mlclns
Copy link
Author

mlclns commented May 17, 2024

same error here. The music library scan always trigger this error:

warning -print_format json -show_streams -show_format
[03:10:47] [INF] [40] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Starting /usr/lib/jellyfin-ffmpeg/ffprobe with args -analyzeduration 200M -probesize 1G -i file:"/media/Music/许嵩/单曲/许嵩 - 绝代风华.flac" -threads 0 -v warning -print_format json -show_streams -show_format
[03:11:08] [ERR] [40] Emby.Server.Implementations.ScheduledTasks.TaskManager: Error executing Scheduled Task
System.InvalidOperationException: Must add values for the following parameters: @Type2, @Value2, @CleanValue2
   at Microsoft.Data.Sqlite.SqliteCommand.GetStatements()+MoveNext()
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
   at Emby.Server.Implementations.Data.SqliteItemRepository.InsertItemValues(Guid id, List`1 values, SqliteConnection db)
   at Emby.Server.Implementations.Data.SqliteItemRepository.UpdateItemValues(Guid itemId, List`1 values, SqliteConnection db)
   at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItemsInTransaction(SqliteConnection db, IEnumerable`1 tuples)
   at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItems(IReadOnlyList`1 items, CancellationToken cancellationToken)
   at Emby.Server.Implementations.Library.LibraryManager.UpdateItemsAsync(IReadOnlyList`1 items, BaseItem parent, ItemUpdateType updateReason, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.MetadataService`2.SaveItemAsync(MetadataResult`1 result, ItemUpdateType reason, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.MetadataService`2.RefreshMetadata(BaseItem item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.BaseItem.RefreshMetadata(MetadataRefreshOptions options, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Audio.MusicAlbum.RefreshAllMetadata(MetadataRefreshOptions refreshOptions, IProgress`1 progress, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Folder.RefreshAllMetadataForContainer(IMetadataContainer container, MetadataRefreshOptions refreshOptions, IProgress`1 progress, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Folder.RefreshChildMetadata(BaseItem child, MetadataRefreshOptions refreshOptions, Boolean recursive, IProgress`1 progress, 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.RefreshChildMetadata(BaseItem child, MetadataRefreshOptions refreshOptions, Boolean recursive, IProgress`1 progress, 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.RefreshChildMetadata(BaseItem child, MetadataRefreshOptions refreshOptions, Boolean recursive, IProgress`1 progress, 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)
[03:11:08] [INF] [40] Emby.Server.Implementations.ScheduledTasks.TaskManager: 扫描媒体库 Failed after 0 minute(s) and 26 seconds
[03:11:16] [INF] [20] Emby.Server.Implementations.ScheduledTasks.TaskManager: Webhook Item Added Notifier Completed after 0 minute(s) and 0 seconds

And i have checked the file: /media/Music/许嵩/单曲/许嵩 - 绝代风华.flac exists in docker.

Is your music library mounted read-only as well?

@wlt-cortex
Copy link

nop, have test for write file:

(py3) wlt@watermelon:/data1/webdav$ docker exec -it jellyfin /bin/bash
I have no name!@watermelon:/$ jellyfin/^C
I have no name!@watermelon:/$ ls
bin  boot  cache  config  dev  etc  home  jellyfin  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
I have no name!@watermelon:/$ touch /media/Music/许嵩/单曲/a.txt
I have no name!@watermelon:/$ rm /media/Music/许嵩/单曲/a.txt

it seems the music code has some bugs, as i check the source code but no c# environment, don't know how to develop:

5171         private void InsertItemValues(Guid id, List<(int MagicNumber, string Value)> values, SqliteConnection db)
5172         {
5173             const int Limit = 100;
5174             var startIndex = 0;
5175
5176             const string StartInsertText = "insert into ItemValues (ItemId, Type, Value, CleanValue) values ";
5177             var insertText = new StringBuilder(StartInsertText);
5178             while (startIndex < values.Count)
5179             {
5180                 var endIndex = Math.Min(values.Count, startIndex + Limit);
5181
5182                 for (var i = startIndex; i < endIndex; i++)
5183                 {
5184                     insertText.AppendFormat(
5185                         CultureInfo.InvariantCulture,
5186                         "(@ItemId, @Type{0}, @Value{0}, @CleanValue{0}),",
5187                         i);
5188                 }
5189
5190                 // Remove trailing comma
5191                 insertText.Length--;
5192
5193                 using (var statement = PrepareStatement(db, insertText.ToString()))
5194                 {
5195                     statement.TryBind("@ItemId", id);
5196
5197                     for (var i = startIndex; i < endIndex; i++)
5198                     {
5199                         var index = i.ToString(CultureInfo.InvariantCulture);
5200
5201                         var currentValueInfo = values[i];
5202
5203                         var itemValue = currentValueInfo.Value;
5204
5205                         // Don't save if invalid
5206                         if (string.IsNullOrWhiteSpace(itemValue))
5207                         {
5208                             continue;
5209                         }
5210
5211                         statement.TryBind("@Type" + index, currentValueInfo.MagicNumber);
5212                         statement.TryBind("@Value" + index, itemValue);
5213                         statement.TryBind("@CleanValue" + index, GetCleanValue(itemValue));
5214                     }
5215
5216                     statement.ExecuteNonQuery();
5217                 }
5218
5219                 startIndex += Limit;
5220                 insertText.Length = StartInsertText.Length;
5221             }
5222         }

The error above indicates that the sql query statement may miss value for @Type2, @Value2, @CleanValue2. Maybe the TryBind method will fail to add the specfic number to query?

@wlt-cortex
Copy link

I wonder if there's a bug in the version of jellyfin-ffmpeg bundled with this docker image, given the MediaBrowser.Common.FfmpegException: ffmpeg image extraction failed for file

My jellyfin log doesn't contain this error. Only wait for some seconds and output error after the line:

[03:10:47] [INF] [40] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Starting /usr/lib/jellyfin-ffmpeg/ffprobe with args -analyzeduration 200M -probesize 1G -i file:"/media/Music/许嵩/单曲/许嵩 - 绝代风华.flac" -threads 0 -v warning -print_format json -show_streams -show_format

The above jellyfin-ffmpeg command i have tested in docker works right, here is the output:

I have no name!@watermelon:/$ /usr/lib/jellyfin-ffmpeg/ffprobe -analyzeduration 200M -probesize 1G -i file:"/media/Music/许嵩/单曲/许嵩 - 绝代风华.flac" -threads 0 -v warning -print_format json -show_streams -show_format   {
    "streams": [
        {
            "index": 0,
            "codec_name": "flac",
            "codec_long_name": "FLAC (Free Lossless Audio Codec)",
            "codec_type": "audio",
            "codec_tag_string": "[0][0][0][0]",
            "codec_tag": "0x0000",
            "sample_fmt": "s16",
            "sample_rate": "44100",
            "channels": 2,
            "channel_layout": "stereo",
            "bits_per_sample": 0,
            "initial_padding": 0,
            "r_frame_rate": "0/0",
            "avg_frame_rate": "0/0",                                                                                                                                                                                                       "time_base": "1/44100",
            "start_pts": 0,                                                                                                                                                                                                                "start_time": "0.000000",
            "duration_ts": 11249747,
            "duration": "255.096304",
            "bits_per_raw_sample": "16",                                                                                                                                                                                                   "extradata_size": 34,
            "disposition": {        
...
    "format": {
        "filename": "file:/media/Music/许嵩/单曲/许嵩 - 绝代风华.flac",
        "nb_streams": 2,
        "nb_programs": 0,
        "format_name": "flac",
        "format_long_name": "raw FLAC",
        "start_time": "0.000000",
        "duration": "255.096304",
        "size": "29017334",
        "bit_rate": "910004",
        "probe_score": 100,
        "tags": {
            "ALBUM": "天下3十周年主题曲",
            "ARTIST": "许嵩",
            "DATE": "2018",
            "ENCODER": "Lavf57.71.100",
            "GENRE": "pop",
            "LYRICS": "[00:00.00]作词 : 许嵩\n[00:01.00]作曲 : 许嵩\n[00:03.77]编曲:郑楠\n[00:06.37]\n[00:21.15]林间伞下\n[00:24.51]你与我执手信步伞下\n[00:29.52]竹上隐客惊起了雀鸦\n[00:34.54]速决高下 挥剑一刹那\n[00:37.59]\n[00:41.40]入鞘还家\n[00:44.71]你莞尔沏来春涧草茶\n[00:49.74]子落楸枰 雨落鸳鸯瓦\n[00:54.86]经年相伴 心饴不化\n[00:58.29]\n[01:00.06]曾经年少鲜衣怒马\n[01:04.92]寒沙里征战与杀伐\n[01:10.03]玉帐外传来了胡笳\n[01:13.76]如你驻扎 取我牵挂\n[01:20.16]我心里那一座天下\n[01:25.23]你坐镇笑靥如桃花\n[01:30.21]世间当真有两全法\n[01:35.16]江山深处抚你风华\n[01:40.73]\n[02:02.13]入鞘还家\n[02:05.59]你莞尔沏来春涧草茶\n[02:10.62]子落楸枰 雨落鸳鸯瓦\n[02:15.68]经年相伴 心饴不化\n[02:19.22]\n[02:20.94]曾经年少鲜衣怒马\n[02:25.84]寒沙里征战与杀伐\n[02:30.82]玉帐外传来了胡笳\n[02:34.67]如你驻扎 取我牵挂\n[02:41.13]我心里那一座天下\n[02:46.03]你坐镇笑靥如桃花\n[02:51.04]世间当真有两全法\n[02:56.13]江山深处抚你风华\n[03:01.15]曾经年少鲜衣怒马\n[03:06.22]寒沙里征战与杀伐\n[03:11.31]玉帐外传来了胡笳\n[03:15.09]如你驻扎 取我牵挂\n[03:21.45]我心里那一座天下\n[03:26.39]你坐镇笑靥如桃花\n[03:31.47]世间当真有两全法\n[03:36.49]江山深处抚你风华\n[03:41.62]世间当真有两全法\n[03:46.68]江山深处抚你风华\n[03:51.53]\n[03:56.71]制作人:许嵩\n[03:58.07]吉他:高飞\n[03:59.34]古筝:程皓如\n[04:00.73]琵琶:刘小菁\n[04:02.08]笛子:冯
天石\n[04:03.49]和声:许嵩\n[04:04.91]录音师:许嵩/刘韧\n[04:06.35]混音师:许嵩\n[04:07.78]母带处理:许嵩\n[04:09.09]录音室:Vae Studio/TTL",
            "TITLE": "绝代风华",
            "track": "01"
        }
    }
}

So it‘s highly probable that the SQL query statement is missing some value in Music library scenario.

@Bond-009 Bond-009 self-assigned this May 17, 2024
Bond-009 added a commit to Bond-009/jellyfin that referenced this issue May 17, 2024
Whitespace values weren't being filtered out in advance
Remove the posibility of this happening again by always binding

Should fix jellyfin#11605
@mlclns
Copy link
Author

mlclns commented May 18, 2024

Can confirm 10.9.2 fixed this issue. Thanks so much to everyone who looked into it and got it merged and released so quickly!

@mlclns mlclns closed this as completed May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Fixed
Development

No branches or pull requests

7 participants