Skip to content

Unable to upload attachments due to InvalidCastException #7062

@NHMPB

Description

@NHMPB

Steps To Reproduce

  1. Add new Login entry and save it (or open existing one)
  2. Edit entry to upload new attachment
  3. Select file and click on Upload

Expected Result

File is uploaded successfully and stored.

Actual Result

The upload fails with a 500 error:

{"message":"An unhandled server error has occurred.","validationErrors":null,"exceptionMessage":null,"exceptionStackTrace":null,"innerExceptionMessage":null,"object":"error"}

In the api logs on the server, I can see this error message:

2026-02-24T08:36:04.4202136+00:00 0HNJJFTGM9AJI:00000001 [ERR] Unhandled exception (f80f533c)
System.InvalidCastException: Unable to cast object of type 'Bit.Core.Vault.Models.Data.CipherOrganizationDetails' to type 'Bit.Core.Vault.Models.Data.CipherDetails'.
   at Bit.Core.Vault.Services.CipherService.CreateAttachmentForDelayedUploadAsync(Cipher cipher, String key, String fileName, Int64 fileSize, Boolean adminRequest, Guid savingUserId, Nullable`1 lastKnownRevisionDate) in /source/src/Core/Vault/Services/Implementations/CipherService.cs:line 236
   at Bit.Api.Vault.Controllers.CiphersController.PostAttachment(Guid id, AttachmentRequestModel request) in /source/src/Api/Vault/Controllers/CiphersController.cs:line 1364
   at lambda_method1871(Closure, Object)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.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)

Screenshots or Videos

No response

Additional Context

Bitwarden was running on self-hosted unified version 2025.7.2-beta for long time and without issues, until this error started happening. It was first seen last week, without any changes to the deployment or infrastructure. Now it blocks all uploads consistently, no new uploads are possible.
I tried to update to latest lite version 2026.2.0 to see if it fixes the issue, but it still remains. The logs/stacktrace are from latest version.

Githash Version

56b85d4

Environment Details

Running in AWS ECS Fargate with RDS Aurora Postgres 16 cluster and EFS volume.

Database Image

No response

Issue Tracking Info

  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugbw-lite-deployAn Issue related to Bitwarden Lite deployment

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions