Skip to content

Unable to delete account if the project is removed #12601

@kiranchavala

Description

@kiranchavala

problem

Unable to delete account if the project is removed

versions

ACS 4.22

The steps to reproduce the bug

  1. Create a project
Image
  1. Create a account/user with User role
Image
  1. Add User to the project, Select the project role as Admin
Image
  1. Delete the project with clean up option
Image
  1. Delete the user
Image
  1. Disable the account and Delete the account >> Exception observed
Image
2026-02-06 05:19:09,201 DEBUG [c.c.a.ApiServer] (qtp1390913202-23:[ctx-52b15b57, ctx-b39021de]) (logid:c0aa78bd) Retrieved cmdEventType from job info: ACCOUNT.DELETE
2026-02-06 05:19:09,203 INFO  [o.a.c.f.j.i.AsyncJobMonitor] (API-Job-Executor-22:[ctx-54696ea9, job-166]) (logid:92e3ffb4) Add job-166 into job monitoring
2026-02-06 05:19:09,204 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] (qtp1390913202-23:[ctx-52b15b57, ctx-b39021de]) (logid:c0aa78bd) submit async job-166, details: AsyncJob {"accountId":2,"cmd":"org.apache.cloudstack.api.command.admin.account.DeleteAccountCmd","cmdInfo":"{\"response\":\"json\",\"ctxUserId\":\"2\",\"sessionkey\":\"nDTziuDnO4qxnRScKDVyKQTZukU\",\"httpmethod\":\"POST\",\"ctxStartEventId\":\"623\",\"id\":\"f004ffb3-f8d0-4297-8951-fc83bdd10fad\",\"ctxDetails\":\"{\\\"interface com.cloud.user.Account\\\":\\\"f004ffb3-f8d0-4297-8951-fc83bdd10fad\\\"}\",\"ctxAccountId\":\"2\",\"uuid\":\"f004ffb3-f8d0-4297-8951-fc83bdd10fad\",\"cmdEventType\":\"ACCOUNT.DELETE\"}","cmdVersion":0,"completeMsid":null,"created":null,"id":166,"initMsid":32988016411316,"instanceId":12,"instanceType":"Account","lastPolled":null,"lastUpdated":null,"processStatus":0,"removed":null,"result":null,"resultCode":0,"status":"IN_PROGRESS","userId":2,"uuid":"1ba7a022-f715-4df5-a771-99e59e80e38f"}
2026-02-06 05:19:09,204 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl$5] (API-Job-Executor-22:[ctx-54696ea9, job-166]) (logid:1ba7a022) Executing AsyncJob {"accountId":2,"cmd":"org.apache.cloudstack.api.command.admin.account.DeleteAccountCmd","cmdInfo":"{\"response\":\"json\",\"ctxUserId\":\"2\",\"sessionkey\":\"nDTziuDnO4qxnRScKDVyKQTZukU\",\"httpmethod\":\"POST\",\"ctxStartEventId\":\"623\",\"id\":\"f004ffb3-f8d0-4297-8951-fc83bdd10fad\",\"ctxDetails\":\"{\\\"interface com.cloud.user.Account\\\":\\\"f004ffb3-f8d0-4297-8951-fc83bdd10fad\\\"}\",\"ctxAccountId\":\"2\",\"uuid\":\"f004ffb3-f8d0-4297-8951-fc83bdd10fad\",\"cmdEventType\":\"ACCOUNT.DELETE\"}","cmdVersion":0,"completeMsid":null,"created":null,"id":166,"initMsid":32988016411316,"instanceId":12,"instanceType":"Account","lastPolled":null,"lastUpdated":null,"processStatus":0,"removed":null,"result":null,"resultCode":0,"status":"IN_PROGRESS","userId":2,"uuid":"1ba7a022-f715-4df5-a771-99e59e80e38f"}
2026-02-06 05:19:09,205 DEBUG [c.c.a.ApiServlet] (qtp1390913202-23:[ctx-52b15b57, ctx-b39021de]) (logid:c0aa78bd) ===END===  10.0.3.251 -- POST
command=deleteAccount
response=json
id=f004ffb3-f8d0-4297-8951-fc83bdd10fad
sessionkey=nDTziuDnO4qxnRScKDVyKQTZukU

2026-02-06 05:19:09,207 DEBUG [c.c.u.AccountManagerImpl] (API-Job-Executor-22:[ctx-54696ea9, job-166, ctx-32d73b76]) (logid:1ba7a022) Account [Account [{"accountName":"admin","id":2,"uuid":"ef7f35bc-fffc-11f0-8d07-1e009f0002b4"}]] has access to resource.
2026-02-06 05:19:09,223 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] (API-Job-Executor-22:[ctx-54696ea9, job-166]) (logid:1ba7a022) Complete async job-166, jobStatus: FAILED, resultCode: 431, result: org.apache.cloudstack.api.response.ExceptionResponse/null/{"uuidList":[],"errorcode":"431","errortext":"Unable to delete account [12], because it manages the following project(s): [4]. Please, remove the account from these projects or demote it to a regular project role first."}

What to do about it?

Account should get deleted

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions