server
server copied to clipboard
Web Client - Unable to move from Personal Vault to Organization Collection - sqlite
Steps To Reproduce
This works fine on the Bitwarden Desktop App, but not on the latest 2024.12.0 Bitwarden Web Client.
- Go to 'a personal vault item - card, login, note'
- Click on 'Assign to Collection - Organization/Collection name'
Expected Result
Item is assigned to the organization and the collection selected.
Actual Result
An error has occurred. An unhandled server error has occurred.
Screenshots or Videos
No response
Additional Context
This is the log from the api.log
2024-12-21 03:33:19.430 +00:00 [ERR] SQLite Error 19: 'UNIQUE constraint failed: Cipher.Id'.
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'UNIQUE constraint failed: Cipher.Id'.
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.ExecuteReader()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
at System.Data.Common.DbCommand.ExecuteNonQueryAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location ---
at LinqToDB.Data.DataConnection.ExecuteNonQueryAsync(CancellationToken cancellationToken)
at LinqToDB.Data.DataConnection.ExecuteNonQueryAsync(CancellationToken cancellationToken)
at LinqToDB.Data.DataConnection.ExecuteNonQueryDataAsync(CancellationToken cancellationToken)
at LinqToDB.Data.DataConnection.ExecuteNonQueryDataAsync(CancellationToken cancellationToken)
at LinqToDB.Data.CommandInfo.ExecuteAsync(CancellationToken cancellationToken)
at LinqToDB.Data.CommandInfo.ExecuteAsync(CancellationToken cancellationToken)
at LinqToDB.DataProvider.MultipleRowsHelper.ExecuteAsync(CancellationToken cancellationToken)
at LinqToDB.DataProvider.BasicBulkCopy.MultipleRowsCopyHelperAsync(MultipleRowsHelper helper, IEnumerable source, String from, Action`1 prepFunction, Action`3 addFunction, Action`1 finishFunction, CancellationToken cancellationToken, Int32 maxParameters, Int32 maxSqlLength)
at LinqToDB.EntityFrameworkCore.LinqToDBForEFTools.BulkCopyAsync[T](DbContext context, BulkCopyOptions options, IEnumerable`1 source, CancellationToken cancellationToken)
at Bit.Infrastructure.EntityFramework.Vault.Repositories.CipherRepository.UpdateCiphersAsync(Guid userId, IEnumerable`1 ciphers) in /source/src/Infrastructure.EntityFramework/Vault/Repositories/CipherRepository.cs:line 775
at Bit.Core.Vault.Services.CipherService.ShareManyAsync(IEnumerable`1 cipherInfos, Guid organizationId, IEnumerable`1 collectionIds, Guid sharingUserId)
at Bit.Api.Vault.Controllers.CiphersController.PutShareMany(CipherBulkShareRequestModel model) in /source/src/Api/Vault/Controllers/CiphersController.cs:line 901
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Githash Version
c507058e-dirty
Environment Details
Docker, using sqlite.
Database Image
Sqlite
Issue-Link
https://github.com/bitwarden/server/issues/2480
Issue Tracking Info
- [X] I understand that work is tracked outside of Github. A PR will be linked to this issue should one be opened to address it, but Bitwarden doesn't use fields like "assigned", "milestone", or "project" to track progress.
Hi there,
Thank you for your report!
I was able to reproduce this issue, and I have flagged this to our engineering team.
If you wish to add any further information/screenshots/recordings etc., please feel free to do so at any time - our engineering team will be happy to review these.
Thanks once again!
I have the same issue on Bitwarden unified deployment with Docker compose and MariaDB as database image. Here is the excerpt from api.log:
fail: Bit.Api.Utilities.ExceptionHandlerFilterAttribute[0]
=> SpanId:e1f011aac9f9cdbe, TraceId:0765be8a477622e1d229e782dd7f7d73, ParentId:0000000000000000 => ConnectionId:0HN9KNLSI6B43 => RequestPath:/ciphers/share RequestId:0HN9KNLSI6B43:00000001 => IpAddress:::ffff:127.0.0.1 UserAgent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 DeviceType:9 Origin:9 ClientVersion:2025.1.0 => Bit.Api.Vault.Controllers.CiphersController.PutShareMany (Api)
Duplicate entry 'REDACTED' for key 'PRIMARY'
MySqlConnector.MySqlException (0x80004005): Duplicate entry 'REDACTED' for key 'PRIMARY'
at MySqlConnector.Core.ServerSession.ReceiveReplyAsync(IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ServerSession.cs:line 894
at MySqlConnector.Core.ResultSet.ReadResultSetHeaderAsync(IOBehavior ioBehavior) in /_/src/MySqlConnector/Core/ResultSet.cs:line 37
at MySqlConnector.MySqlDataReader.ActivateResultSet(CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlDataReader.cs:line 130
at MySqlConnector.MySqlDataReader.InitAsync(CommandListPosition commandListPosition, ICommandPayloadCreator payloadCreator, IDictionary`2 cachedProcedures, IMySqlCommand command, CommandBehavior behavior, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlDataReader.cs:line 483
at MySqlConnector.Core.CommandExecutor.ExecuteReaderAsync(CommandListPosition commandListPosition, ICommandPayloadCreator payloadCreator, CommandBehavior behavior, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/CommandExecutor.cs:line 56
at MySqlConnector.MySqlCommand.ExecuteNonQueryAsync(IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlCommand.cs:line 309
at LinqToDB.Data.DataConnection.ExecuteNonQueryAsync(CancellationToken cancellationToken)
at LinqToDB.Data.DataConnection.ExecuteNonQueryAsync(CancellationToken cancellationToken)
at LinqToDB.Data.DataConnection.ExecuteNonQueryDataAsync(CancellationToken cancellationToken)
at LinqToDB.Data.DataConnection.ExecuteNonQueryDataAsync(CancellationToken cancellationToken)
at LinqToDB.Data.CommandInfo.ExecuteAsync(CancellationToken cancellationToken)
at LinqToDB.Data.CommandInfo.ExecuteAsync(CancellationToken cancellationToken)
at LinqToDB.DataProvider.MultipleRowsHelper.ExecuteAsync(CancellationToken cancellationToken)
at LinqToDB.DataProvider.BasicBulkCopy.MultipleRowsCopyHelperAsync(MultipleRowsHelper helper, IEnumerable source, String from, Action`1 prepFunction, Action`3 addFunction, Action`1 finishFunction, CancellationToken cancellationToken, Int32 maxParameters, Int32 maxSqlLength)
at LinqToDB.EntityFrameworkCore.LinqToDBForEFTools.BulkCopyAsync[T](DbContext context, BulkCopyOptions options, IEnumerable`1 source, CancellationToken cancellationToken)
at Bit.Infrastructure.EntityFramework.Vault.Repositories.CipherRepository.UpdateCiphersAsync(Guid userId, IEnumerable`1 ciphers) in /source/src/Infrastructure.EntityFramework/Vault/Repositories/CipherRepository.cs:line 821
at Bit.Core.Vault.Services.CipherService.ShareManyAsync(IEnumerable`1 cipherInfos, Guid organizationId, IEnumerable`1 collectionIds, Guid sharingUserId) in /source/src/Core/Vault/Services/Implementations/CipherService.cs:line 630
at Bit.Api.Vault.Controllers.CiphersController.PutShareMany(CipherBulkShareRequestModel model) in /source/src/Api/Vault/Controllers/CiphersController.cs:line 901
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Only happens in the web client. Android app and browser extesion do just fine.
Web client: 2025.1.0 Server: 2025.1.3 gitHash: 549681d1-dirty
Any movement on this? Please let us know if you need more information.
Same thing happens with postgresql
fail: Bit.Api.Utilities.ExceptionHandlerFilterAttribute[0]
=> SpanId:fa835b890a883e83, TraceId:a884af9602e8a1e1d88568b6c3026893, ParentId:0000000000000000 => ConnectionId:0HNBAISTN0ME4 => RequestPath:/ciphers/share RequestId:0HNBAISTN0ME4:00000001 => IpAddress:::ffff:127.0.0.1 UserAgent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 DeviceType:9 Origin:9 ClientVersion:2025.2.2 => Bit.Api.Vault.Controllers.CiphersController.PutShareMany (Api)
23505: duplicate key value violates unique constraint "PK_Cipher"
DETAIL: Detail redacted as it may contain sensitive data. Specify 'Include Error Detail' in the connection string to include this information.
Npgsql.PostgresException (0x80004005): 23505: duplicate key value violates unique constraint "PK_Cipher"
DETAIL: Detail redacted as it may contain sensitive data. Specify 'Include Error Detail' in the connection string to include this information.
at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)
at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken)
at LinqToDB.Data.DataConnection.ExecuteNonQueryAsync(CancellationToken cancellationToken)
at LinqToDB.Data.DataConnection.ExecuteNonQueryAsync(CancellationToken cancellationToken)
at LinqToDB.Data.DataConnection.ExecuteNonQueryDataAsync(CancellationToken cancellationToken)
at LinqToDB.Data.DataConnection.ExecuteNonQueryDataAsync(CancellationToken cancellationToken)
at LinqToDB.Data.CommandInfo.ExecuteAsync(CancellationToken cancellationToken)
at LinqToDB.Data.CommandInfo.ExecuteAsync(CancellationToken cancellationToken)
at LinqToDB.DataProvider.MultipleRowsHelper.ExecuteAsync(CancellationToken cancellationToken)
at LinqToDB.DataProvider.BasicBulkCopy.MultipleRowsCopyHelperAsync(MultipleRowsHelper helper, IEnumerable source, String from, Action`1 prepFunction, Action`3 addFunction, Action`1 finishFunction, CancellationToken cancellationToken, Int32 maxParameters, Int32 maxSqlLength)
at LinqToDB.EntityFrameworkCore.LinqToDBForEFTools.BulkCopyAsync[T](DbContext context, BulkCopyOptions options, IEnumerable`1 source, CancellationToken cancellationToken)
at Bit.Infrastructure.EntityFramework.Vault.Repositories.CipherRepository.UpdateCiphersAsync(Guid userId, IEnumerable`1 ciphers) in /source/src/Infrastructure.EntityFramework/Vault/Repositories/CipherRepository.cs:line 867
at Bit.Core.Vault.Services.CipherService.ShareManyAsync(IEnumerable`1 cipherInfos, Guid organizationId, IEnumerable`1 collectionIds, Guid sharingUserId) in /source/src/Core/Vault/Services/Implementations/CipherService.cs:line 638
at Bit.Api.Vault.Controllers.CiphersController.PutShareMany(CipherBulkShareRequestModel model) in /source/src/Api/Vault/Controllers/CiphersController.cs:line 954
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Exception data:
Severity: ERROR
SqlState: 23505
MessageText: duplicate key value violates unique constraint "PK_Cipher"
Detail: Detail redacted as it may contain sensitive data. Specify 'Include Error Detail' in the connection string to include this information.
SchemaName: public
TableName: Cipher
ConstraintName: PK_Cipher
File: nbtinsert.c
Line: 664
Routine: _bt_check_unique
Web client: 2025.2.2 Server: 2025.3.0 gitHash: https://github.com/bitwarden/server/commit/a040509f814fb920df1868835655a2d19a0cd9c7
Any update on this?
Should be fixed in 2025.4.3 by #5543 which probably introduces #5808