Possible database corruption causing files to be placed in the wrong episode number or unrecognized
VERSION INFORMATION
Server Version: 4.2.2.0
Desktop Version: 4.2.1.0
If you've compiled your own version, please use the last commit you compiled.
LOG FILE
DESCRIPTION
Two issues that seem to be related.
First, there's a file that got placed in the wrong episode number. Episode 78 is showing up under episode 77.
Second, episode 77 is unrecognized even though the hashes are correct.
The file is here, and you'll see that all of the hashes match: https://anidb.net/file/373848
The logs do show a "unique constraint failed" when I run a rehash of the file. Snippet below, but entire log is attached above:
[2024-09-21 00:44:00:059] Error|CommandProcessorGeneral.WorkerCommands_DoWork => CommandRequestImplementation.ProcessCommand => CommandRequest_ProcessFile.Process Error processing CommandRequest_ProcessFile: 1485: NHibernate.Exceptions.GenericADOException: could not insert: [Shoko.Server.Models.SVR_AniDB_File][SQL: INSERT INTO AniDB_File (DateTimeUpdated, File_Description, File_ReleaseDate, File_Source, FileID, FileName, FileSize, FileVersion, IsCensored, IsDeprecated, IsChaptered, InternalVersion, GroupID, Hash) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); select last_insert_rowid()]
---> Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'UNIQUE constraint failed: AniDB_File.FileID'.
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 NHibernate.AdoNet.AbstractBatcher.DoExecuteReader(DbCommand cmd)
at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(DbCommand cmd)
at NHibernate.Id.IdentityGenerator.InsertSelectDelegate.ExecuteAndExtract(DbCommand insert, ISessionImplementor session)
at NHibernate.Id.Insert.AbstractReturningDelegate.PerformInsert(SqlCommandInfo insertSQL, ISessionImplementor session, IBinder binder)
--- End of inner exception stack trace ---
at NHibernate.Id.Insert.AbstractReturningDelegate.PerformInsert(SqlCommandInfo insertSQL, ISessionImplementor session, IBinder binder)
at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object[] fields, Boolean[] notNull, SqlCommandInfo sql, Object obj, ISessionImplementor session)
at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object[] fields, Object obj, ISessionImplementor session)
at NHibernate.Action.EntityIdentityInsertAction.Execute()
at NHibernate.Engine.ActionQueue.InnerExecute(IExecutable executable)
at NHibernate.Engine.ActionQueue.Execute(IExecutable executable)
at NHibernate.Event.Default.AbstractSaveEventListener.PerformSaveOrReplicate(Object entity, EntityKey key, IEntityPersister persister, Boolean useIdentityColumn, Object anything, IEventSource source, Boolean requiresImmediateIdAccess)
at NHibernate.Event.Default.AbstractSaveEventListener.PerformSave(Object entity, Object id, IEntityPersister persister, Boolean useIdentityColumn, Object anything, IEventSource source, Boolean requiresImmediateIdAccess)
at NHibernate.Event.Default.AbstractSaveEventListener.SaveWithGeneratedId(Object entity, String entityName, Object anything, IEventSource source, Boolean requiresImmediateIdAccess)
at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent event)
at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.EntityIsTransient(SaveOrUpdateEvent event)
at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.OnSaveOrUpdate(SaveOrUpdateEvent event)
at NHibernate.Impl.SessionImpl.FireSaveOrUpdate(SaveOrUpdateEvent event)
at NHibernate.Impl.SessionImpl.SaveOrUpdate(Object obj)
at Shoko.Server.Repositories.BaseCachedRepository`2.Save(T obj) in D:\a\ShokoServer\ShokoServer\Shoko.Server\Repositories\BaseCachedRepository.cs:line 228
at Shoko.Server.Repositories.AniDB_FileRepository.Save(SVR_AniDB_File obj, Boolean updateStats) in D:\a\ShokoServer\ShokoServer\Shoko.Server\Repositories\Cached\AniDB_FileRepository.cs:line 42
at Shoko.Server.Commands.AniDB.CommandRequest_GetFile.Process() in D:\a\ShokoServer\ShokoServer\Shoko.Server\Commands\AniDB\CommandRequest_GetFile.cs:line 121
at Shoko.Server.Commands.Generic.CommandRequestImplementation.ProcessCommand() in D:\a\ShokoServer\ShokoServer\Shoko.Server\Commands\Generic\CommandRequestImplementation.cs:line 65
at Shoko.Server.Commands.CommandRequest_ProcessFile.TryGetAniDBFileFromAniDB(SVR_VideoLocal vidLocal, Dictionary`2 animeIDs) in D:\a\ShokoServer\ShokoServer\Shoko.Server\Commands\Import\CommandRequest_ProcessFile.cs:line 395
at Shoko.Server.Commands.CommandRequest_ProcessFile.ProcessFile_AniDB(SVR_VideoLocal vidLocal) in D:\a\ShokoServer\ShokoServer\Shoko.Server\Commands\Import\CommandRequest_ProcessFile.cs:line 129
at Shoko.Server.Commands.CommandRequest_ProcessFile.Process() in D:\a\ShokoServer\ShokoServer\Shoko.Server\Commands\Import\CommandRequest_ProcessFile.cs:line 85
STEPS TO REPRODUCE
From a fresh install, ran import on my folder some time back. I only noticed the weirdness when I was trying to resolve my unrecognized files.
We're going to launch a new stable in a few weeks, which should fix that. Hit More Info on the mislinked file, and there should be a button to update the info on it. Worst case, move them, run remove missing files, and reimport them.
Let me know if that helps
Sorry for the super late update on this. This is no longer an issue for me.