Misha12 / GrillBot

Discord bot with features primarily for VUT FIT discord guild.
https://git.grillbot.cloud/
MIT License
5 stars 5 forks source link

Group unverify fails on primary key violation. #236

Closed Misha12 closed 3 years ago

Misha12 commented 3 years ago
Discord.Commands.CommandException: Error occurred executing "" for Toaster#1111 in VUT FIT/izp.
 ---> Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while updating the entries. See the inner exception for details.
 ---> Microsoft.Data.SqlClient.SqlException (0x80131904): Violation of PRIMARY KEY constraint 'PK_Unverifies'. Cannot insert duplicate key in object 'dbo.Unverifies'. The duplicate key value is (12032).
The statement has been terminated.
   at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__169_0(Task`1 result)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   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)
ClientConnectionId:e9f95075-c844-4869-8a21-7ef930cf972f
Error Number:2627,State:1,Class:14
   --- 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(DbContext _, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Grillbot.Services.Unverify.UnverifyLogger.LogUnverifyAsync(UnverifyUserProfile profile, IGuild guild, IUser fromUser) in /src/Grillbot/Services/Unverify/UnverifyLogger.cs:line 39
   at Grillbot.Services.Unverify.UnverifyService.SetUnverifyAsync(SocketUser socketUser, String time, String data, SocketGuild guild, SocketUser fromUser, Boolean selfUnverify, List`1 toKeep, SocketRole mutedRole) in /src/Grillbot/Services/Unverify/UnverifyService.cs:line 101
   at Grillbot.Services.Unverify.UnverifyService.SetUnverifyAsync(List`1 users, String time, String data, SocketGuild guild, SocketUser fromUser) in /src/Grillbot/Services/Unverify/UnverifyService.cs:line 71
   at Grillbot.Modules.UnverifyModule.SetUnverifyAsync(String time, String reasonAndUserMentions) in /src/Grillbot/Modules/UnverifyModule.cs:line 49
   at Grillbot.Modules.UnverifyModule.SetUnverifyAsync(String time, String reasonAndUserMentions) in /src/Grillbot/Modules/UnverifyModule.cs:line 60
   at Discord.Commands.ModuleClassBuilder.<>c__DisplayClass6_0.<<BuildCommand>g__ExecuteCallback|0>d.MoveNext()
--- End of stack trace from previous location ---
   at Discord.Commands.CommandInfo.ExecuteInternalAsync(ICommandContext context, Object[] args, IServiceProvider services)
   --- End of inner exception stack trace ---