EmbyStat: Sync error with Jellyfin and Emby

Bug report

Describe the bug A fresh install of Embystats Beta 20, Beta 19 or Beta 18 will not sync with Jellyfin or Emby. The users, plugins, and library names seem to sync properly, but the libraries always error out no matter what I try. This is using the docker containers.

To Reproduce Steps to reproduce the behavior:

Install Embystats beta 18, 19 or 20 docker version, point to jellyfin or emby, attempt media sync.

Expected behavior Media syncs

Screenshots See log below, but this error seems to be the start of a domino effect: [ERROR] Error while running job LiteDB.LiteException: Index key must be less than 255 bytes.

System (please complete the following information):

  • OS: Host is ubuntu 18.04
  • Browser Chrome
  • Version Beta 20

Additional context

2020-07-28 08:21:44.7168 [INFO] MEDIASYNC-JOB	First delete all existing media and root media libraries from database so we have a clean start. 
2020-07-28 08:21:44.7168 [INFO] MEDIASYNC-JOB	Asking MediaServer for all root folders 
2020-07-28 08:21:44.8680 [INFO] MEDIASYNC-JOB	Found 38 root items, getting ready for processing 
2020-07-28 08:21:44.8680 [INFO] MEDIASYNC-JOB	Lets start processing movies 
2020-07-28 08:21:45.0626 [ERROR] Error while running job System.NullReferenceException: Object reference not set to an instance of an object.
   at EmbyStat.Clients.Base.Http.BaseHttpClient.GetMovieCount(String parentId)
   at EmbyStat.Clients.Jellyfin.Http.JellyfinHttpClient.EmbyStat.Clients.Base.Http.IHttpClient.GetMovieCount(String parentId)
   at EmbyStat.Jobs.Jobs.Sync.MediaSyncJob.ProcessMoviesAsync(IReadOnlyList`1 libraries, CancellationToken cancellationToken)
   at EmbyStat.Jobs.Jobs.Sync.MediaSyncJob.RunJobAsync()
   at EmbyStat.Jobs.BaseJob.Execute()
2020-07-28 08:21:45.1425 [ERROR] MEDIASYNC-JOB	Job failed, check logs for more info. 
2020-07-28 08:21:48.2916 [INFO] Connecting to wss://xxx.xxx.xxx.xxx:xxxx/embywebsocket?api_key=xxxxxxxxxxxxxx&deviceId=removed
2020-07-28 08:21:49.2635 [WARN] Failed to process the job 'removed': an exception occurred. Retry attempt 2 of 2 will be performed in 00:01:08. System.NullReferenceException: Object reference not set to an instance of an object.
   at EmbyStat.Clients.Base.Http.BaseHttpClient.GetMovieCount(String parentId)
   at EmbyStat.Clients.Jellyfin.Http.JellyfinHttpClient.EmbyStat.Clients.Base.Http.IHttpClient.GetMovieCount(String parentId)
   at EmbyStat.Jobs.Jobs.Sync.MediaSyncJob.ProcessMoviesAsync(IReadOnlyList`1 libraries, CancellationToken cancellationToken)
   at EmbyStat.Jobs.Jobs.Sync.MediaSyncJob.RunJobAsync()
   at EmbyStat.Jobs.BaseJob.Execute()
   at EmbyStat.Jobs.BaseJob.Execute()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2020-07-28 08:21:53.1402 [INFO] Connecting to wss://xxx.xxx.xxx.xxx:xxxx/embywebsocket?api_key=xxxxxxxxxxxxxx&deviceId=removed
2020-07-28 08:21:58.1405 [INFO] Connecting to wss://xxx.xxx.xxx.xxx:xxxx/embywebsocket?api_key=xxxxxxxxxxxxxx&deviceId=removed
2020-07-28 08:22:03.1388 [INFO] Connecting to wss://xxx.xxx.xxx.xxx:xxxx/embywebsocket?api_key=xxxxxxxxxxxxxx&deviceId=removed 
2020-07-28 08:22:04.3153 [INFO] SMALLEMBYSYNC-JOB	Starting job 
2020-07-28 08:22:04.5035 [INFO] SMALLEMBYSYNC-JOB	Server info downloaded 
2020-07-28 08:22:04.6465 [INFO] SMALLEMBYSYNC-JOB	Server plugins downloaded 
2020-07-28 08:22:05.2483 [INFO] SMALLEMBYSYNC-JOB	Server users downloaded 
2020-07-28 08:22:05.3558 [ERROR] Error while running job LiteDB.LiteException: Index key must be less than 255 bytes.
   at LiteDB.Engine.IndexService.AddNode(CollectionIndex index, BsonValue key, PageAddress dataBlock, Byte level, IndexNode last)
   at LiteDB.Engine.IndexService.AddNode(CollectionIndex index, BsonValue key, PageAddress dataBlock, IndexNode last)
   at LiteDB.Engine.LiteEngine.InsertDocument(Snapshot snapshot, BsonDocument doc, BsonAutoId autoId, IndexService indexer, DataService data)
   at LiteDB.Engine.LiteEngine.<>c__DisplayClass30_0.<Upsert>b__0(TransactionService transaction)
   at LiteDB.Engine.LiteEngine.AutoTransaction[T](Func`2 fn)
   at LiteDB.Engine.LiteEngine.Upsert(String collection, IEnumerable`1 docs, BsonAutoId autoId)
   at LiteDB.SharedEngine.Upsert(String collection, IEnumerable`1 docs, BsonAutoId autoId)
   at LiteDB.LiteCollection`1.Upsert(IEnumerable`1 entities)
   at EmbyStat.Repositories.MediaServerRepository.<>c__DisplayClass17_0.<UpsertDevices>b__0()
   at EmbyStat.Repositories.BaseRepository.ExecuteQuery(Action query)
   at EmbyStat.Repositories.MediaServerRepository.UpsertDevices(IEnumerable`1 devices)
   at EmbyStat.Services.MediaServerService.GetAndProcessDevices()
   at EmbyStat.Jobs.Jobs.Sync.SmallSyncJob.RunJobAsync()
   at EmbyStat.Jobs.BaseJob.Execute()
2020-07-28 08:22:05.5705 [ERROR] SMALLEMBYSYNC-JOB	Job failed, check logs for more info. ```

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 31 (14 by maintainers)

Commits related to this issue

Most upvoted comments

It is possible that this is already fixed in the code I have locally. We need to retest this when beta.21 is released. I’m doing my best to finish the release this week but can’t promise anything.

@mregni, Just tested the new nightly. Embystat seems to sync without any problems for me now. Thanks for implementing the fix.

Still getting the same error on the lastest update that I got today. 0.2.1-dev.1279 2:33:48 PM 08/13/2020 - MEDIA-SYNC - 0 movies found in parent with id f137a2dd21bbc1b99aa5c0f6bf02a805. Propably means something is wrong with the HTTP call. Also you have a typo with word “probably”.

I will say I am no longer having the ping error though.

I have the same problem as @Protektor-Desura where Embystat gives me the following error when doing a media synchronization: MEDIA-SYNC - 0 movies found in parent with id f137a2dd21bbc1b99aa5c0f6bf02a805. Propably means something is wrong with the HTTP call.

I’m running embystat through unraid and got this error in the linuxserver/embystat docker and the above posted uping/embystat:nightly docker.

i also looked into the Jellyfin logs and found embystat sending the following 2 get requests during media synchronization: http://[serverdomain]/Items?ParentId=f137a2dd21bbc1b99aa5c0f6bf02a805&StartIndex=0&recursive=True&IncludeItemTypes=Movie http://[serverdomain]/Items?UserId=fa89fb6c-f3b7-4cc5-bc17-9522e3b94246&SeriesStatuses=&fields=&Filters=&ImageTypes=&AirDays=&EnableImageTypes=&ParentId=f137a2dd21bbc1b99aa5c0f6bf02a805&StartIndex=0&Limit=1&recursive=True&IncludeItemTypes=Movie%2cBoxSet

Both get requests gave the following error in the jellyfin logs: System.NullReferenceException: Object reference not set to an instance of an object.

After some quick testing with get requests i think i found the problem. embystat is not using a userid in the first get request and a non existing userid in it’s second get request “UserId=fa89fb6c-f3b7-4cc5-bc17-9522e3b94246” In a quick search this userid seems to be hardcoded into the following two files: Tests.Unit/Clients/BaseHttpClientTests.cs Tests.Unit/Extensions/RestRequestExtensionTests.cs

When i change the userid to the userid of my jellyfin admin account the get requests seems to work.

I also noticed that embystat already saved the userid of my jellyfin admin account in the usersettings.json file. under MediaServer, UserID.

@Protektor-Desura, what OS is running EmbyStat on? Because you can also navigate to the /Logs folder to check for them. It’s normal that EmbyStat not asking for a Jellyfin password because you supplied EmbyStat with an API token.

Your problem does seem like a different one than initially posted because your instance is able to fetch the movie count.

I’m the original poster, I believe you were replying to someone else that chimed in on this thread. I don’t know if their problem is the same or different from mine. I’ll try the latest nightly and report back. Thank you!