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

SQLite Error 19: 'FOREIGN KEY constraint failed' #1830

Open
Dead-Lemon opened this issue Jun 30, 2022 · 7 comments
Open

SQLite Error 19: 'FOREIGN KEY constraint failed' #1830

Dead-Lemon opened this issue Jun 30, 2022 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@Dead-Lemon
Copy link

I recently installed embystat for the 1st time, using the latest linuxserver/embystat docker container, running 0.2.0-beta.37
It is connecting to a Jellyfin, also running in a docker container, currently version 10.8.1

There no issues with establishing the connection, but soon as I start syncing my movies or series, it fails at some point with the SQLite Error 19.

Especially when syncing the TV shows, it fails soon after starting and ends up only importing 1 series, continually failing at the same point.

[2022-06-30 12:13:47] []  [INF] --------------------------------------------------------------------
[2022-06-30 12:13:47] []  [INF] System info:
[2022-06-30 12:13:47] []  [INF] 	Environment	Production
[2022-06-30 12:13:47] []  [INF] 	Debugger	False
[2022-06-30 12:13:47] []  [INF] 	Process Name	EmbyStat
[2022-06-30 12:13:47] []  [INF] 	Version		0.2.0.0
[2022-06-30 12:13:47] []  [INF] 	Log level:	Information
[2022-06-30 12:13:47] []  [INF] 	Port:		6555
[2022-06-30 12:13:47] []  [INF] 	SSL Port:	6556
[2022-06-30 12:13:47] []  [INF] 	SSL Enabled:	False
[2022-06-30 12:13:47] []  [INF] 	URLs:		*
[2022-06-30 12:13:47] []  [INF] 	Config dir:	/config
[2022-06-30 12:13:47] []  [INF] 	Log dir:	/config/logs
[2022-06-30 12:13:47] []  [INF] 	Data dir:	/config
[2022-06-30 12:13:47] []  [INF] 	Can update:	False
[2022-06-30 12:13:47] []  [INF] 	As service:	False
[2022-06-30 12:13:47] []  [INF] --------------------------------------------------------------------
[2022-06-30 12:13:47] [Microsoft.Hosting.Lifetime]  [INF] Now listening on: http://[::]:6555
[2022-06-30 12:13:48] [EmbyStat.Core.DataStore.EsDbContext]  [INF] Found 1 pending database migration
[2022-06-30 12:13:48] [EmbyStat.Core.DataStore.EsDbContext]  [INF] Migrating database now, please hold on
[2022-06-30 12:13:49] [EmbyStat.Core.DataStore.EsDbContext]  [INF] Migrating DONE
[2022-06-30 12:13:50] [Microsoft.Hosting.Lifetime]  [INF] Application started. Press Ctrl+C to shut down.
[2022-06-30 12:13:50] [Microsoft.Hosting.Lifetime]  [INF] Hosting environment: Production
[2022-06-30 12:13:50] [Microsoft.Hosting.Lifetime]  [INF] Content root path: /opt/embystat
[2022-06-30 12:15:35] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] ---------------------------------
[2022-06-30 12:15:35] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] Starting job
[2022-06-30 12:15:35] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] ---------------------------------
[2022-06-30 12:15:41] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] Processing information from 33099 people
[2022-06-30 12:15:50] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] Processing genres
[2022-06-30 12:15:50] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] Processing shows
[2022-06-30 12:15:50] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] 1 libraries are selected, getting ready for processing
[2022-06-30 12:15:50] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] Found 230 changed shows since last sync in TV Shows
[2022-06-30 12:15:50] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] Fetching next block of 50 shows...
[2022-06-30 12:15:54] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] Found 159 missing episodes for show Chicago Fire
[2022-06-30 12:15:57] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] Found 0 missing episodes for show Surviving Jack
[2022-06-30 12:15:58] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] Found 128 missing episodes for show Chicago P.D.
[2022-06-30 12:15:58] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [ERR] Error while running job
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'FOREIGN KEY constraint failed'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
   at System.Data.Common.DbCommand.ExecuteNonQueryAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location ---
   at Dapper.SqlMapper.ExecuteMultiImplAsync(IDbConnection cnn, CommandDefinition command, IEnumerable multiExec) in /_/Dapper/SqlMapper.Async.cs:line 624
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.ProcessShowBlock(Library library, IReadOnlyList`1 shows, IEnumerable`1 genres, Double increment)
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.ProcessChangedShows(Library library, IEnumerable`1 genres, Double logIncrementBase)
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.ProcessShowsAsync()
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.RunJobAsync()
   at EmbyStat.Jobs.BaseJob.Execute()
[2022-06-30 12:15:59] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [ERR] SQLite Error 19: 'FOREIGN KEY constraint failed'.
[2022-06-30 12:15:59] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [ERR] Job failed, check logs for more info.
[2022-06-30 12:15:59] [Hangfire.AutomaticRetryAttribute]  [WRN] Failed to process the job 'eb176291-3d1b-4a98-8935-93985dd67f3f': an exception occurred. Retry attempt 1 of 2 will be performed in 00:00:17.
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'FOREIGN KEY constraint failed'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
   at System.Data.Common.DbCommand.ExecuteNonQueryAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location ---
   at Dapper.SqlMapper.ExecuteMultiImplAsync(IDbConnection cnn, CommandDefinition command, IEnumerable multiExec) in /_/Dapper/SqlMapper.Async.cs:line 624
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.ProcessShowBlock(Library library, IReadOnlyList`1 shows, IEnumerable`1 genres, Double increment)
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.ProcessChangedShows(Library library, IEnumerable`1 genres, Double logIncrementBase)
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.ProcessShowsAsync()
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.RunJobAsync()
   at EmbyStat.Jobs.BaseJob.Execute()
   at EmbyStat.Jobs.BaseJob.Execute()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
@mregni mregni self-assigned this Jul 4, 2022
@mregni mregni added the bug Something isn't working label Jul 4, 2022
@mregni
Copy link
Owner

mregni commented Jul 4, 2022

Thanks for posting, looking into the issue. @Dead-Lemon, can you please run the container with debug flag enabled? -g 1
That will give me a lot more info where and why your sync is failing.

@Dead-Lemon
Copy link
Author

I managed to run the container with the debug flag.
The results from the logs, from failure to end of file (I added another TV show folder to scan from jellyfin, it progressed further, unfortunatly still eventual got stuck on a show, with the same error)

[2022-07-04 16:07:12] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] Found 0 missing episodes for show FLCL
[2022-07-04 16:07:12] [System.Net.Http.HttpClient.mediaServerClient.LogicalHandler]  [INF] Start processing HTTP request GET "https://xxx.xxx.xxx.xxx:xxxx/items?UserId=11a6bc3810434df2928531c8b18971c6&EnableTotalRecordCount=True&Fields=OriginalTitle%2CGenres%2CDateCreated%2CExternalUrls%2CStudios%2CPath%2COverview%2CProviderIds%2CSortName%2CParentId%2CPeople%2CMediaSources%2CMediaStreams%2CPremiereDate%2CCommunityRating%2COfficialRating%2CProductionYear%2CStatus%2CRunTimeTicks&EnableImageTypes=Primary&LocationTypes=FileSystem&ParentId=f1e94da948a6bd003e7e2cba276467b2&Recursive=True&IncludeItemTypes=Season"
[2022-07-04 16:07:12] [System.Net.Http.HttpClient.mediaServerClient.ClientHandler]  [INF] Sending HTTP request GET "https://xxx.xxx.xxx.xxx:xxxx/items?UserId=11a6bc3810434df2928531c8b18971c6&EnableTotalRecordCount=True&Fields=OriginalTitle%2CGenres%2CDateCreated%2CExternalUrls%2CStudios%2CPath%2COverview%2CProviderIds%2CSortName%2CParentId%2CPeople%2CMediaSources%2CMediaStreams%2CPremiereDate%2CCommunityRating%2COfficialRating%2CProductionYear%2CStatus%2CRunTimeTicks&EnableImageTypes=Primary&LocationTypes=FileSystem&ParentId=f1e94da948a6bd003e7e2cba276467b2&Recursive=True&IncludeItemTypes=Season"
[2022-07-04 16:07:12] [System.Net.Http.HttpClient.mediaServerClient.ClientHandler]  [INF] Received HTTP response headers after 186.7261ms - 200
[2022-07-04 16:07:12] [System.Net.Http.HttpClient.mediaServerClient.LogicalHandler]  [INF] End processing HTTP request after 187.4332ms - 200
[2022-07-04 16:07:12] [System.Net.Http.HttpClient.mediaServerClient.LogicalHandler]  [INF] Start processing HTTP request GET "https://xxx.xxx.xxx.xxx:xxxx/items?UserId=11a6bc3810434df2928531c8b18971c6&EnableTotalRecordCount=True&Fields=OriginalTitle%2CGenres%2CDateCreated%2CExternalUrls%2CStudios%2CPath%2COverview%2CProviderIds%2CSortName%2CParentId%2CMediaSources%2CMediaStreams%2CPremiereDate%2CCommunityRating%2COfficialRating%2CProductionYear%2CStatus%2CRunTimeTicks&EnableImageTypes=Banner%2CPrimary%2CThumb%2CLogo&LocationTypes=FileSystem&ParentId=f1e94da948a6bd003e7e2cba276467b2&Recursive=True&IncludeItemTypes=Episode"
[2022-07-04 16:07:12] [System.Net.Http.HttpClient.mediaServerClient.ClientHandler]  [INF] Sending HTTP request GET "https://xxx.xxx.xxx.xxx:xxxx/items?UserId=11a6bc3810434df2928531c8b18971c6&EnableTotalRecordCount=True&Fields=OriginalTitle%2CGenres%2CDateCreated%2CExternalUrls%2CStudios%2CPath%2COverview%2CProviderIds%2CSortName%2CParentId%2CMediaSources%2CMediaStreams%2CPremiereDate%2CCommunityRating%2COfficialRating%2CProductionYear%2CStatus%2CRunTimeTicks&EnableImageTypes=Banner%2CPrimary%2CThumb%2CLogo&LocationTypes=FileSystem&ParentId=f1e94da948a6bd003e7e2cba276467b2&Recursive=True&IncludeItemTypes=Episode"
[2022-07-04 16:07:13] [System.Net.Http.HttpClient.mediaServerClient.ClientHandler]  [INF] Received HTTP response headers after 327.569ms - 200
[2022-07-04 16:07:13] [System.Net.Http.HttpClient.mediaServerClient.LogicalHandler]  [INF] End processing HTTP request after 327.8871ms - 200
[2022-07-04 16:07:13] [EmbyStat.Core.Shows.ShowRepository]  [DBG] 
SELECT s.*, g.*, se.*, e.*
FROM Shows as s
LEFT JOIN GenreShow AS gs ON (gs.ShowsId = s.Id)
LEFT JOIN Genres AS g ON (gs.GenresId = g.Id)
LEFT JOIN Season AS se ON (s.Id = se.ShowId)
LEFT JOIN Episodes AS e ON (se.Id = e.SeasonId)
WHERE 1=1  AND s.Id = 'f1e94da948a6bd003e7e2cba276467b2'
[2022-07-04 16:07:14] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] Found 0 missing episodes for show Bleach
[2022-07-04 16:07:15] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [ERR] Error while running job
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'FOREIGN KEY constraint failed'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
   at System.Data.Common.DbCommand.ExecuteNonQueryAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location ---
   at Dapper.SqlMapper.ExecuteMultiImplAsync(IDbConnection cnn, CommandDefinition command, IEnumerable multiExec) in /_/Dapper/SqlMapper.Async.cs:line 624
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.ProcessShowBlock(Library library, IReadOnlyList`1 shows, IEnumerable`1 genres, Double increment)
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.ProcessChangedShows(Library library, IEnumerable`1 genres, Double logIncrementBase)
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.ProcessShowsAsync()
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.RunJobAsync()
   at EmbyStat.Jobs.BaseJob.Execute()
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Command]  [DBG] Creating DbCommand for 'ExecuteReader'.
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Command]  [DBG] Created DbCommand for 'ExecuteReader' (0ms).
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Command]  [DBG] Executing DbCommand [Parameters=[@__id_0='?' (DbType = Guid)], CommandType='"Text"', CommandTimeout='30']
SELECT "j"."Id", "j"."CurrentProgressPercentage", "j"."Description", "j"."EndTimeUtc", "j"."StartTimeUtc", "j"."State", "j"."Title", "j"."Trigger"
FROM "Jobs" AS "j"
WHERE "j"."Id" = @__id_0
LIMIT 1
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Command]  [INF] Executed DbCommand (0ms) [Parameters=[@__id_0='?' (DbType = Guid)], CommandType='"Text"', CommandTimeout='30']
SELECT "j"."Id", "j"."CurrentProgressPercentage", "j"."Description", "j"."EndTimeUtc", "j"."StartTimeUtc", "j"."State", "j"."Title", "j"."Trigger"
FROM "Jobs" AS "j"
WHERE "j"."Id" = @__id_0
LIMIT 1
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Command]  [DBG] A data reader was disposed.
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Update]  [DBG] SaveChanges starting for 'EsDbContext'.
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Transaction]  [DBG] Beginning transaction with isolation level 'Unspecified'.
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Transaction]  [DBG] Began transaction with isolation level 'Serializable'.
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Command]  [DBG] Creating DbCommand for 'ExecuteReader'.
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Command]  [DBG] Created DbCommand for 'ExecuteReader' (0ms).
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Command]  [DBG] Executing DbCommand [Parameters=[@p3='?' (DbType = Guid), @p0='?' (DbType = Double), @p1='?' (DbType = DateTime), @p2='?' (DbType = Int32)], CommandType='"Text"', CommandTimeout='30']
UPDATE "Jobs" SET "CurrentProgressPercentage" = @p0, "EndTimeUtc" = @p1, "State" = @p2
WHERE "Id" = @p3;
SELECT changes();
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Command]  [INF] Executed DbCommand (0ms) [Parameters=[@p3='?' (DbType = Guid), @p0='?' (DbType = Double), @p1='?' (DbType = DateTime), @p2='?' (DbType = Int32)], CommandType='"Text"', CommandTimeout='30']
UPDATE "Jobs" SET "CurrentProgressPercentage" = @p0, "EndTimeUtc" = @p1, "State" = @p2
WHERE "Id" = @p3;
SELECT changes();
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Command]  [DBG] A data reader was disposed.
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Transaction]  [DBG] Committing transaction.
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Transaction]  [DBG] Committed transaction.
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Transaction]  [DBG] Disposing transaction.
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Update]  [DBG] SaveChanges completed for 'EsDbContext' with 1 entities written to the database.
[2022-07-04 16:07:15] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [ERR] SQLite Error 19: 'FOREIGN KEY constraint failed'.
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Command]  [DBG] Creating DbCommand for 'ExecuteReader'.
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Command]  [DBG] Created DbCommand for 'ExecuteReader' (0ms).
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Command]  [DBG] Executing DbCommand [Parameters=[@__id_0='?' (DbType = Guid)], CommandType='"Text"', CommandTimeout='30']
SELECT "j"."Id", "j"."CurrentProgressPercentage", "j"."Description", "j"."EndTimeUtc", "j"."StartTimeUtc", "j"."State", "j"."Title", "j"."Trigger"
FROM "Jobs" AS "j"
WHERE "j"."Id" = @__id_0
LIMIT 1
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Command]  [INF] Executed DbCommand (0ms) [Parameters=[@__id_0='?' (DbType = Guid)], CommandType='"Text"', CommandTimeout='30']
SELECT "j"."Id", "j"."CurrentProgressPercentage", "j"."Description", "j"."EndTimeUtc", "j"."StartTimeUtc", "j"."State", "j"."Title", "j"."Trigger"
FROM "Jobs" AS "j"
WHERE "j"."Id" = @__id_0
LIMIT 1
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Command]  [DBG] A data reader was disposed.
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Update]  [DBG] SaveChanges starting for 'EsDbContext'.
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Transaction]  [DBG] Beginning transaction with isolation level 'Unspecified'.
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Transaction]  [DBG] Began transaction with isolation level 'Serializable'.
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Command]  [DBG] Creating DbCommand for 'ExecuteReader'.
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Command]  [DBG] Created DbCommand for 'ExecuteReader' (0ms).
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Command]  [DBG] Executing DbCommand [Parameters=[@p1='?' (DbType = Guid), @p0='?' (DbType = DateTime)], CommandType='"Text"', CommandTimeout='30']
UPDATE "Jobs" SET "EndTimeUtc" = @p0
WHERE "Id" = @p1;
SELECT changes();
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Command]  [INF] Executed DbCommand (0ms) [Parameters=[@p1='?' (DbType = Guid), @p0='?' (DbType = DateTime)], CommandType='"Text"', CommandTimeout='30']
UPDATE "Jobs" SET "EndTimeUtc" = @p0
WHERE "Id" = @p1;
SELECT changes();
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Command]  [DBG] A data reader was disposed.
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Transaction]  [DBG] Committing transaction.
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Transaction]  [DBG] Committed transaction.
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Database.Transaction]  [DBG] Disposing transaction.
[2022-07-04 16:07:15] [Microsoft.EntityFrameworkCore.Update]  [DBG] SaveChanges completed for 'EsDbContext' with 1 entities written to the database.
[2022-07-04 16:07:15] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [ERR] Job failed, check logs for more info.
[2022-07-04 16:07:15] [Hangfire.AutomaticRetryAttribute]  [ERR] Failed to process the job '8fcdedcd-49f6-4104-adaf-cdda3f13e1b2': an exception occurred.
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'FOREIGN KEY constraint failed'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
   at System.Data.Common.DbCommand.ExecuteNonQueryAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location ---
   at Dapper.SqlMapper.ExecuteMultiImplAsync(IDbConnection cnn, CommandDefinition command, IEnumerable multiExec) in /_/Dapper/SqlMapper.Async.cs:line 624
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.ProcessShowBlock(Library library, IReadOnlyList`1 shows, IEnumerable`1 genres, Double increment)
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.ProcessChangedShows(Library library, IEnumerable`1 genres, Double logIncrementBase)
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.ProcessShowsAsync()
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.RunJobAsync()
   at EmbyStat.Jobs.BaseJob.Execute()
   at EmbyStat.Jobs.BaseJob.Execute()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[2022-07-04 16:07:19] [Microsoft.AspNetCore.Hosting.Diagnostics]  [INF] Request starting HTTP/1.1 GET http://xxx.xxx.xxx.xxx:6555/api/log/list - -
[2022-07-04 16:07:19] [Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker]  [INF] Route matched with {action = "GetLogFileList", controller = "Log"}. Executing controller action with signature Microsoft.AspNetCore.Mvc.IActionResult GetLogFileList() on controller EmbyStat.Controllers.Log.LogController (EmbyStat.Controllers).
[2022-07-04 16:07:19] [Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker]  [DBG] Execution plan of authorization filters (in the following order): ["None"]
[2022-07-04 16:07:19] [Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker]  [DBG] Execution plan of resource filters (in the following order): ["None"]
[2022-07-04 16:07:19] [Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker]  [DBG] Execution plan of action filters (in the following order): ["Microsoft.AspNetCore.Mvc.Filters.ControllerActionFilter (Order: -2147483648)","Microsoft.AspNetCore.Mvc.ModelBinding.UnsupportedContentTypeFilter (Order: -3000)"]
[2022-07-04 16:07:19] [Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker]  [DBG] Execution plan of exception filters (in the following order): ["EmbyStat.Common.Exceptions.BusinessExceptionFilterAttribute (Order: 0)"]
[2022-07-04 16:07:19] [Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker]  [DBG] Execution plan of result filters (in the following order): ["Microsoft.AspNetCore.Mvc.ProducesAttribute (Order: 0)"]
[2022-07-04 16:07:19] [Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker]  [DBG] Executing controller factory for controller EmbyStat.Controllers.Log.LogController (EmbyStat.Controllers)
[2022-07-04 16:07:19] [Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker]  [DBG] Executed controller factory for controller EmbyStat.Controllers.Log.LogController (EmbyStat.Controllers)
[2022-07-04 16:07:19] [Microsoft.AspNetCore.Mvc.Infrastructure.DefaultOutputFormatterSelector]  [DBG] List of registered output formatters, in the following order: ["Microsoft.AspNetCore.Mvc.Formatters.HttpNoContentOutputFormatter","Microsoft.AspNetCore.Mvc.Formatters.StringOutputFormatter","Microsoft.AspNetCore.Mvc.Formatters.StreamOutputFormatter","Microsoft.AspNetCore.Mvc.Formatters.SystemTextJsonOutputFormatter"]
[2022-07-04 16:07:19] [Microsoft.AspNetCore.Mvc.Infrastructure.DefaultOutputFormatterSelector]  [DBG] No information found on request to perform content negotiation.
[2022-07-04 16:07:19] [Microsoft.AspNetCore.Mvc.Infrastructure.DefaultOutputFormatterSelector]  [DBG] Attempting to select the first output formatter in the output formatters list which supports a content type from the explicitly specified content types '["application/json"]'.
[2022-07-04 16:07:19] [Microsoft.AspNetCore.Mvc.Infrastructure.DefaultOutputFormatterSelector]  [DBG] Selected output formatter 'Microsoft.AspNetCore.Mvc.Formatters.SystemTextJsonOutputFormatter' and content type 'application/json' to write the response.
[2022-07-04 16:07:19] [Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor]  [INF] Executing OkObjectResult, writing value of type 'System.Collections.Generic.List`1[[EmbyStat.Controllers.Log.LogFileViewModel, EmbyStat.Controllers, Version=0.2.0.0, Culture=neutral, PublicKeyToken=null]]'.
[2022-07-04 16:07:19] [Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker]  [INF] Executed action EmbyStat.Controllers.Log.LogController.GetLogFileList (EmbyStat.Controllers) in 6.9951ms
[2022-07-04 16:07:19] [EmbyStat.Controllers.Middleware.RequestLoggingMiddleware]  [DBG] 
Http Request Information:
	Full Path:	| http://xxx.xxx.xxx.xxx:6555/api/log/list 
	Status: 	| 200
	UserAgent: 	| Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0
	Authenticated: 	| True
	Time: 		| 10.2242ms
	QueryString: 	| 
	Request Body: 	| 
	Response Body: 	| [{"name":"log20220704.txt","size":3648301},{"name":"log20220703.txt","size":105996},{"name":"log20220702.txt","size":83623},{"name":"log20220701.txt","size":6748},{"name":"log20220630.txt","size":3712}]
[2022-07-04 16:07:19] [Microsoft.AspNetCore.Hosting.Diagnostics]  [INF] Request finished HTTP/1.1 GET http://xxx.xxx.xxx.xxx:6555/api/log/list - - - 200 - application/json;+charset=utf-8 12.9988ms
[2022-07-04 16:07:21] [Microsoft.AspNetCore.Hosting.Diagnostics]  [INF] Request starting HTTP/1.1 GET http://xxx.xxx.xxx.xxx:6555/api/log/download/log20220704.txt?anonymous=true - -
[2022-07-04 16:07:21] [Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker]  [INF] Route matched with {action = "GetZipFile", controller = "Log"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.FileContentResult] GetZipFile(System.String, Boolean) on controller EmbyStat.Controllers.Log.LogController (EmbyStat.Controllers).
[2022-07-04 16:07:21] [Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker]  [DBG] Execution plan of authorization filters (in the following order): ["None"]
[2022-07-04 16:07:21] [Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker]  [DBG] Execution plan of resource filters (in the following order): ["None"]
[2022-07-04 16:07:21] [Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker]  [DBG] Execution plan of action filters (in the following order): ["Microsoft.AspNetCore.Mvc.Filters.ControllerActionFilter (Order: -2147483648)","Microsoft.AspNetCore.Mvc.ModelBinding.UnsupportedContentTypeFilter (Order: -3000)"]
[2022-07-04 16:07:21] [Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker]  [DBG] Execution plan of exception filters (in the following order): ["EmbyStat.Common.Exceptions.BusinessExceptionFilterAttribute (Order: 0)"]
[2022-07-04 16:07:21] [Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker]  [DBG] Execution plan of result filters (in the following order): ["None"]
[2022-07-04 16:07:21] [Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker]  [DBG] Executing controller factory for controller EmbyStat.Controllers.Log.LogController (EmbyStat.Controllers)
[2022-07-04 16:07:21] [Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker]  [DBG] Executed controller factory for controller EmbyStat.Controllers.Log.LogController (EmbyStat.Controllers)
[2022-07-04 16:07:21] [Microsoft.AspNetCore.Mvc.ModelBinding.ParameterBinder]  [DBG] Attempting to bind parameter 'fileName' of type 'System.String' ...
[2022-07-04 16:07:21] [Microsoft.AspNetCore.Mvc.ModelBinding.Binders.SimpleTypeModelBinder]  [DBG] Attempting to bind parameter 'fileName' of type 'System.String' using the name 'fileName' in request data ...
[2022-07-04 16:07:21] [Microsoft.AspNetCore.Mvc.ModelBinding.Binders.SimpleTypeModelBinder]  [DBG] Done attempting to bind parameter 'fileName' of type 'System.String'.
[2022-07-04 16:07:21] [Microsoft.AspNetCore.Mvc.ModelBinding.ParameterBinder]  [DBG] Done attempting to bind parameter 'fileName' of type 'System.String'.
[2022-07-04 16:07:21] [Microsoft.AspNetCore.Mvc.ModelBinding.ParameterBinder]  [DBG] Attempting to validate the bound parameter 'fileName' of type 'System.String' ...
[2022-07-04 16:07:21] [Microsoft.AspNetCore.Mvc.ModelBinding.ParameterBinder]  [DBG] Done attempting to validate the bound parameter 'fileName' of type 'System.String'.
[2022-07-04 16:07:21] [Microsoft.AspNetCore.Mvc.ModelBinding.ParameterBinder]  [DBG] Attempting to bind parameter 'anonymous' of type 'System.Boolean' ...
[2022-07-04 16:07:21] [Microsoft.AspNetCore.Mvc.ModelBinding.Binders.SimpleTypeModelBinder]  [DBG] Attempting to bind parameter 'anonymous' of type 'System.Boolean' using the name 'anonymous' in request data ...
[2022-07-04 16:07:21] [Microsoft.AspNetCore.Mvc.ModelBinding.Binders.SimpleTypeModelBinder]  [DBG] Done attempting to bind parameter 'anonymous' of type 'System.Boolean'.
[2022-07-04 16:07:21] [Microsoft.AspNetCore.Mvc.ModelBinding.ParameterBinder]  [DBG] Done attempting to bind parameter 'anonymous' of type 'System.Boolean'.
[2022-07-04 16:07:21] [Microsoft.AspNetCore.Mvc.ModelBinding.ParameterBinder]  [DBG] Attempting to validate the bound parameter 'anonymous' of type 'System.Boolean' ...
[2022-07-04 16:07:21] [Microsoft.AspNetCore.Mvc.ModelBinding.ParameterBinder]  [DBG] Done attempting to validate the bound parameter 'anonymous' of type 'System.Boolean'.
[2022-07-04 16:07:21] [Microsoft.EntityFrameworkCore.Database.Command]  [DBG] Creating DbCommand for 'ExecuteReader'.
[2022-07-04 16:07:21] [Microsoft.EntityFrameworkCore.Database.Command]  [DBG] Created DbCommand for 'ExecuteReader' (0ms).
[2022-07-04 16:07:21] [Microsoft.EntityFrameworkCore.Database.Command]  [DBG] Executing DbCommand [Parameters=[], CommandType='"Text"', CommandTimeout='30']
SELECT "m"."Id", "m"."CachePath", "m"."CanLaunchWebBrowser", "m"."CanSelfRestart", "m"."CanSelfUpdate", "m"."HardwareAccelerationRequiresPremiere", "m"."HasPendingRestart", "m"."HasUpdateAvailable", "m"."HttpServerPortNumber", "m"."HttpsPortNumber", "m"."InternalMetadataPath", "m"."ItemsByNamePath", "m"."LocalAddress", "m"."LogPath", "m"."OperatingSystem", "m"."OperatingSystemDisplayName", "m"."ProgramDataPath", "m"."ServerName", "m"."SupportsAutoRunAtStartup", "m"."SupportsHttps", "m"."SupportsLibraryMonitor", "m"."SystemUpdateLevel", "m"."TranscodingTempPath", "m"."Version", "m"."WanAddress", "m"."WebSocketPortNumber"
FROM "MediaServerInfo" AS "m"
LIMIT 2
[2022-07-04 16:07:21] [Microsoft.EntityFrameworkCore.Database.Command]  [INF] Executed DbCommand (0ms) [Parameters=[], CommandType='"Text"', CommandTimeout='30']
SELECT "m"."Id", "m"."CachePath", "m"."CanLaunchWebBrowser", "m"."CanSelfRestart", "m"."CanSelfUpdate", "m"."HardwareAccelerationRequiresPremiere", "m"."HasPendingRestart", "m"."HasUpdateAvailable", "m"."HttpServerPortNumber", "m"."HttpsPortNumber", "m"."InternalMetadataPath", "m"."ItemsByNamePath", "m"."LocalAddress", "m"."LogPath", "m"."OperatingSystem", "m"."OperatingSystemDisplayName", "m"."ProgramDataPath", "m"."ServerName", "m"."SupportsAutoRunAtStartup", "m"."SupportsHttps", "m"."SupportsLibraryMonitor", "m"."SystemUpdateLevel", "m"."TranscodingTempPath", "m"."Version", "m"."WanAddress", "m"."WebSocketPortNumber"
FROM "MediaServerInfo" AS "m"
LIMIT 2
[2022-07-04 16:07:21] [Microsoft.EntityFrameworkCore.Database.Command]  [DBG] A data reader was disposed.

@Jerrk
Copy link

Jerrk commented Jul 4, 2022

I also get this error

not sure how to activate the debug option, i added -g 1 as extra parameters but then the container will not build

3:31 PM 07/04/2022 | SHOW-SYNC | Job failed, check logs for more info.
-- | -- | --
3:31 PM 07/04/2022 | SHOW-SYNC | SQLite Error 19: 'FOREIGN KEY constraint failed'.
3:31 PM 07/04/2022 | SHOW-SYNC | Fetching next block of 50 shows...
3:31 PM 07/04/2022 | SHOW-SYNC | Found 342 changed shows since last sync in Anime
3:31 PM 07/04/2022 | SHOW-SYNC | 1 libraries are selected, getting ready for processing
3:31 PM 07/04/2022 | SHOW-SYNC | Processing shows
3:31 PM 07/04/2022 | SHOW-SYNC | Processing genres
3:31 PM 07/04/2022 | SHOW-SYNC | Processing information from 28010 people
3:31 PM 07/04/2022 | SHOW-SYNC | ---------------------------------
3:31 PM 07/04/2022 | SHOW-SYNC | Starting job
3:31 PM 07/04/2022 | SHOW-SYNC | ---------------------------------
3:31 PM 07/04/2022 | JOBS | SHOW-SYNC job queued
[2022-07-04 17:31:13] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] ---------------------------------
[2022-07-04 17:31:13] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] Starting job
[2022-07-04 17:31:13] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] ---------------------------------
[2022-07-04 17:31:22] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] Processing information from 28010 people
[2022-07-04 17:31:34] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] Processing genres
[2022-07-04 17:31:34] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] Processing shows
[2022-07-04 17:31:34] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] 1 libraries are selected, getting ready for processing
[2022-07-04 17:31:34] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] Found 342 changed shows since last sync in Anime
[2022-07-04 17:31:34] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] Fetching next block of 50 shows...
[2022-07-04 17:31:38] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [ERR] Error while running job
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'FOREIGN KEY constraint failed'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
   at System.Data.Common.DbCommand.ExecuteNonQueryAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location ---
   at Dapper.SqlMapper.ExecuteMultiImplAsync(IDbConnection cnn, CommandDefinition command, IEnumerable multiExec) in /_/Dapper/SqlMapper.Async.cs:line 624
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.ProcessShowBlock(Library library, IReadOnlyList`1 shows, IEnumerable`1 genres, Double increment)
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.ProcessChangedShows(Library library, IEnumerable`1 genres, Double logIncrementBase)
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.ProcessShowsAsync()
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.RunJobAsync()
   at EmbyStat.Jobs.BaseJob.Execute()
[2022-07-04 17:31:38] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [ERR] SQLite Error 19: 'FOREIGN KEY constraint failed'.
[2022-07-04 17:31:38] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [ERR] Job failed, check logs for more info.
[2022-07-04 17:31:38] [Hangfire.AutomaticRetryAttribute]  [WRN] Failed to process the job '20d4b800-54c9-45b6-bdcd-a615b0eb59bc': an exception occurred. Retry attempt 1 of 2 will be performed in 00:00:24.
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'FOREIGN KEY constraint failed'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
   at System.Data.Common.DbCommand.ExecuteNonQueryAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location ---
   at Dapper.SqlMapper.ExecuteMultiImplAsync(IDbConnection cnn, CommandDefinition command, IEnumerable multiExec) in /_/Dapper/SqlMapper.Async.cs:line 624
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.ProcessShowBlock(Library library, IReadOnlyList`1 shows, IEnumerable`1 genres, Double increment)
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.ProcessChangedShows(Library library, IEnumerable`1 genres, Double logIncrementBase)
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.ProcessShowsAsync()
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.RunJobAsync()
   at EmbyStat.Jobs.BaseJob.Execute()
   at EmbyStat.Jobs.BaseJob.Execute()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[2022-07-04 17:32:08] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] ---------------------------------
[2022-07-04 17:32:08] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] Starting job
[2022-07-04 17:32:08] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] ---------------------------------
[2022-07-04 17:32:15] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] Processing information from 28010 people
[2022-07-04 17:32:28] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] Processing genres
[2022-07-04 17:32:28] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] Processing shows
[2022-07-04 17:32:28] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] 1 libraries are selected, getting ready for processing
[2022-07-04 17:32:28] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] Found 342 changed shows since last sync in Anime
[2022-07-04 17:32:28] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [INF] Fetching next block of 50 shows...
[2022-07-04 17:32:32] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [ERR] Error while running job
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'FOREIGN KEY constraint failed'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
   at System.Data.Common.DbCommand.ExecuteNonQueryAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location ---
   at Dapper.SqlMapper.ExecuteMultiImplAsync(IDbConnection cnn, CommandDefinition command, IEnumerable multiExec) in /_/Dapper/SqlMapper.Async.cs:line 624
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.ProcessShowBlock(Library library, IReadOnlyList`1 shows, IEnumerable`1 genres, Double increment)
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.ProcessChangedShows(Library library, IEnumerable`1 genres, Double logIncrementBase)
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.ProcessShowsAsync()
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.RunJobAsync()
   at EmbyStat.Jobs.BaseJob.Execute()
[2022-07-04 17:32:32] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [ERR] SQLite Error 19: 'FOREIGN KEY constraint failed'.
[2022-07-04 17:32:32] [EmbyStat.Jobs.Jobs.Sync.ShowSyncJob]  [ERR] Job failed, check logs for more info.
[2022-07-04 17:32:32] [Hangfire.AutomaticRetryAttribute]  [WRN] Failed to process the job '20d4b800-54c9-45b6-bdcd-a615b0eb59bc': an exception occurred. Retry attempt 2 of 2 will be performed in 00:01:14.
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'FOREIGN KEY constraint failed'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
   at System.Data.Common.DbCommand.ExecuteNonQueryAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location ---
   at Dapper.SqlMapper.ExecuteMultiImplAsync(IDbConnection cnn, CommandDefinition command, IEnumerable multiExec) in /_/Dapper/SqlMapper.Async.cs:line 624
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Core.Shows.ShowRepository.UpsertShows(IEnumerable`1 shows)
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.ProcessShowBlock(Library library, IReadOnlyList`1 shows, IEnumerable`1 genres, Double increment)
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.ProcessChangedShows(Library library, IEnumerable`1 genres, Double logIncrementBase)
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.ProcessShowsAsync()
   at EmbyStat.Jobs.Jobs.Sync.ShowSyncJob.RunJobAsync()
   at EmbyStat.Jobs.BaseJob.Execute()
   at EmbyStat.Jobs.BaseJob.Execute()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

@Dead-Lemon
Copy link
Author

Hey @Jerrk, I added the -g 1 to /etc/services.d/embystat/run
I rebuild the container with the change, as I wasn't sure if I could change the file in the container.

#!/usr/bin/with-contenv bash

cd /opt/embystat || exit

exec \
    s6-setuidgid abc /opt/embystat/EmbyStat -g 1 \
        --data-dir /config \
        --log-dir /config/logs \
        --config-dir /config \
        --enable-updates false

@mregni
Copy link
Owner

mregni commented Jul 12, 2022

Still not sure why it is failing, but I will add an extra check in the show sync asap.

@andyfore
Copy link

andyfore commented Dec 5, 2022

@mregni has there been anymore movement on this issue? New installation with version 0.2.0-beta.38 and I still seeing this error.

@mnejing
Copy link

mnejing commented Jan 19, 2023

I'm concerned this project is abandoned at this point.

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
None yet
Development

No branches or pull requests

5 participants