[GH-ISSUE #3326] Error deleting emtpy (0 users, 0 items) organisation #1532

Closed
opened 2026-03-03 02:09:57 +03:00 by kerem · 2 comments
Owner

Originally created by @smainz on GitHub (Mar 9, 2023).
Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/3326

Subject of the issue

I have an organisation with 0 users and 0 items which I want to delete from the admin page.
grafik

Once I enter the correct UUID
grafik

I get this error message :

grafik

In the logs it complains about a foreign key constraint violation:

vaultwarden    | [2023-03-09 10:18:54.828][request][INFO] POST /admin/organizations/45f5a31c-51c7-4c65-a8f5-c049fbf39660/delete
vaultwarden    | [2023-03-09 10:18:54.839][error][ERROR] Error saving organization.
vaultwarden    | [CAUSE] DatabaseError(
vaultwarden    |     ForeignKeyViolation,
vaultwarden    |     "FOREIGN KEY constraint failed",
vaultwarden    | )
vaultwarden    | [2023-03-09 10:18:54.844][response][INFO] (delete_organization) POST /admin/organizations/<uuid>/delete => 400 Bad Request

Deployment environment

  • Vaultwarden version: v1.27.0
  • Web-vault version: v2022.12.0
  • Running within Docker: true (Base: Debian), Docker Image vaultwarden/server:latest
  • Database type: SQLite
  • Database version: 3.39.2
  • Clients used: Web-Vault (Admin page)
  • Reverse proxy and version: traefik 2.9.8 (probably not relevant)

Steps to reproduce

I am not really sure how to reproduce this as I can not create an empty organization. This organisation has been created by a user before I restricted the creation of organisations to myself. The user which created the organisationhas been deleted before.

The problem does not occur with organisations having a member.

Expected behaviour

I expected the organisation to be deleted.

Actual behaviour

The organisation still exists.

Troubleshooting data

What data do you need to analyse this?

Originally created by @smainz on GitHub (Mar 9, 2023). Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/3326 ### Subject of the issue I have an organisation with 0 users and 0 items which I want to delete from the admin page. ![grafik](https://user-images.githubusercontent.com/15262922/223991695-647b77e8-599f-4eb1-9cfb-f576c7fc8d51.png) Once I enter the correct UUID ![grafik](https://user-images.githubusercontent.com/15262922/223998099-985d9501-bca9-40e2-8de3-4336a9450eff.png) I get this error message : ![grafik](https://user-images.githubusercontent.com/15262922/223992245-1225619d-c6dc-4cfd-b26b-da43770dca06.png) In the logs it complains about a foreign key constraint violation: ``` vaultwarden | [2023-03-09 10:18:54.828][request][INFO] POST /admin/organizations/45f5a31c-51c7-4c65-a8f5-c049fbf39660/delete vaultwarden | [2023-03-09 10:18:54.839][error][ERROR] Error saving organization. vaultwarden | [CAUSE] DatabaseError( vaultwarden | ForeignKeyViolation, vaultwarden | "FOREIGN KEY constraint failed", vaultwarden | ) vaultwarden | [2023-03-09 10:18:54.844][response][INFO] (delete_organization) POST /admin/organizations/<uuid>/delete => 400 Bad Request ``` ### Deployment environment * Vaultwarden version: v1.27.0 * Web-vault version: v2022.12.0 * Running within Docker: true (Base: Debian), Docker Image vaultwarden/server:latest * Database type: SQLite * Database version: 3.39.2 * Clients used: Web-Vault (Admin page) * Reverse proxy and version: traefik 2.9.8 (probably not relevant) ### Steps to reproduce I am not really sure how to reproduce this as I can not create an empty organization. This organisation has been created by a user before I restricted the creation of organisations to myself. The user which created the organisationhas been deleted before. The problem does not occur with organisations having a member. ### Expected behaviour I expected the organisation to be deleted. ### Actual behaviour The organisation still exists. ### Troubleshooting data What data do you need to analyse this?
kerem closed this issue 2026-03-03 02:09:58 +03:00
Author
Owner

@BlackDex commented on GitHub (Mar 9, 2023):

This issue is already fixed in the latest testing tagged images or main branch via #3252.

<!-- gh-comment-id:1461797950 --> @BlackDex commented on GitHub (Mar 9, 2023): This issue is already fixed in the latest `testing` tagged images or `main` branch via #3252.
Author
Owner

@smainz commented on GitHub (Mar 9, 2023):

Thanks for the fas tresponse!
You are right, it is a dangling group:

sqlite> select count(*) from collections where org_uuid = '45f5a31c-51c7-4c65-a8f5-c049fbf39660';
0
sqlite> select count(*) from organizations where uuid = '45f5a31c-51c7-4c65-a8f5-c049fbf39660';
1
sqlite> select count(*) from users_organizations where org_uuid = '45f5a31c-51c7-4c65-a8f5-c049fbf39660';
0
sqlite> select count(*) from org_policies where org_uuid = '45f5a31c-51c7-4c65-a8f5-c049fbf39660';
0
sqlite> select count(*) from "ciphers"  where org_uuid = '45f5a31c-51c7-4c65-a8f5-c049fbf39660';
Error: no such column: org_uuid
sqlite> select count(*) from "ciphers"  where organization_uuid = '45f5a31c-51c7-4c65-a8f5-c049fbf39660';
0
sqlite> select count(*) from sends  where organization_uuid = '45f5a31c-51c7-4c65-a8f5-c049fbf39660';
0
sqlite> select count(*) from groups  where organizations_uuid = '45f5a31c-51c7-4c65-a8f5-c049fbf39660';
1
sqlite>
<!-- gh-comment-id:1461803678 --> @smainz commented on GitHub (Mar 9, 2023): Thanks for the fas tresponse! You are right, it is a dangling group: ```SQL sqlite> select count(*) from collections where org_uuid = '45f5a31c-51c7-4c65-a8f5-c049fbf39660'; 0 sqlite> select count(*) from organizations where uuid = '45f5a31c-51c7-4c65-a8f5-c049fbf39660'; 1 sqlite> select count(*) from users_organizations where org_uuid = '45f5a31c-51c7-4c65-a8f5-c049fbf39660'; 0 sqlite> select count(*) from org_policies where org_uuid = '45f5a31c-51c7-4c65-a8f5-c049fbf39660'; 0 sqlite> select count(*) from "ciphers" where org_uuid = '45f5a31c-51c7-4c65-a8f5-c049fbf39660'; Error: no such column: org_uuid sqlite> select count(*) from "ciphers" where organization_uuid = '45f5a31c-51c7-4c65-a8f5-c049fbf39660'; 0 sqlite> select count(*) from sends where organization_uuid = '45f5a31c-51c7-4c65-a8f5-c049fbf39660'; 0 sqlite> select count(*) from groups where organizations_uuid = '45f5a31c-51c7-4c65-a8f5-c049fbf39660'; 1 sqlite> ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vaultwarden#1532
No description provided.