Kavita icon indicating copy to clipboard operation
Kavita copied to clipboard

Series get duplicated

Open Roshri opened this issue 11 months ago • 8 comments

What happened?

Kinda related to #2747 I'm copying what I posted on discord

I know it's marked as solved, but one thing I noticed with the series that had the foreign key constrait failed error and became duplicated was this

I moved the series to kavita
komf then found a better titled match (in this case Viz official title) and changed the series name
scan happens and I end up with dupes

Don't know if this info is useful or not

image

image

image

What did you expect?

If a series name gets updated, don't keep two series pointing to the same files

Kavita Version Number - Don't see your version number listed? Then your install is out of date. Please update and see if your issue still persists.

0.7.14 - Stable

What operating system is Kavita being hosted from?

Windows

If the issue is being seen on Desktop, what OS are you running where you see the issue?

Windows

If the issue is being seen in the UI, what browsers are you seeing the problem on?

Firefox

If the issue is being seen on Mobile, what OS are you running where you see the issue?

Android

If the issue is being seen on the UI, what browsers are you seeing the problem on?

Firefox

Relevant log output

DELETE FROM "Series"
WHERE "Id" = @p0
RETURNING 1;
[Kavita] [2024-03-20 09:11:42.533 -03:00  42] [Error] Microsoft.EntityFrameworkCore.Update An exception occurred in the database while saving changes for context type 'API.Data.DataContext'.
Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details.
 ---> 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.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList`1 entriesToSave, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(StateManager stateManager, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details.
 ---> 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.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList`1 entriesToSave, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(StateManager stateManager, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)

Additional Notes

No response

Roshri avatar Mar 20 '24 14:03 Roshri

Okay this one is a bit tricky because changing the Series name isn't "technically" supported. Is Komf making this change API only or in the ComicInfo.xml?

majora2007 avatar Mar 30 '24 19:03 majora2007

Komf is set to work with both API and comicinfo. This way I have the metadata in the files and I also get all the weblinks on Kavita.

I know changing names isn't supported, I wish it was though. In this case expected behavior would be to delete the first series and keep the second one but it keeps both of them

Roshri avatar Mar 30 '24 20:03 Roshri

So is komf writing the new series tag to all the files or just the first? Because if not all, then they would still be attributed to the old series and one folder would derive 2 series in Kavita.

majora2007 avatar Mar 30 '24 20:03 majora2007

Iirc it was for the whole series. Can't check right now since I have my machine powered off for a few days, I'm moving out.

Roshri avatar Mar 30 '24 20:03 Roshri

No rush.

majora2007 avatar Mar 30 '24 20:03 majora2007

@Roshri Were you able to resolve this? There has been a few releases to Kavita since you open the initial issue.

DieselTech avatar Jul 23 '24 22:07 DieselTech

EDIT: answered was for another similar issue.

This got fixed with a plex dance. From time to time I get some series that get duplicated but a full library scan fixes it

Roshri avatar Jul 24 '24 14:07 Roshri

Yeah I saw this happen occasionally and I think it's due to some of the major changes in the scanner over all this time and some series having something legacy with causes issues. Hence why the Plex dance fixes them.

majora2007 avatar Jul 25 '24 06:07 majora2007