Skip to content

[Bug] Unable to delete a user #3354

@MohandL3G

Description

@MohandL3G

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed. / 请使用英语提交,否则会被关闭。
  • Please do not modify this template :) and fill in all the required fields.

Cloudreve version

4.14.1

Pro or Community Edition

Community (Open Source)

Database type

PostgreSQL

Browser and operating system

Chrome 145

Steps to reproduce

  1. Go to Dashboard.
  2. Go to Users.
  3. Click on Trash icon to delete the user.
  4. Confirm by clicking OK.
    I get this error:
    Database operation failed. (Failed to delete user)

Here's the log:

[cloudreve] [Info]	 2026-03-11 04:59:32 [/home/aaronliu/vsts/_work/2/s/pkg/logging/logger.go:193] [Cid: 3290494e-1d3b-45d1-982b-8a3cd1ade488] [Incoming]  200 |   21.411948ms |    38.252.57.32 | POST     "/api/v4/admin/user/batch/delete"
[postgresql] 2026-03-10 20:59:32.172 UTC [136] ERROR:  update or delete on table "users" violates foreign key constraint "oauth_grants_users_oauth_grants" on table "oauth_grants"
[postgresql] 2026-03-10 20:59:32.172 UTC [136] DETAIL:  Key (id)=(2) is still referenced from table "oauth_grants".
[postgresql] 2026-03-10 20:59:32.172 UTC [136] STATEMENT:  DELETE FROM "users" WHERE "users"."id" = $1

✔️ Expected Behavior

to just delete the User.

❌ Actual Behavior

giving me an error:
Database operation failed. (Failed to delete user)

Addition context information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlogbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions