12

I am trying to delete a GCP project, but each time I get a message that says:

Error
The project has a lien against it.

Tracking Number: 

Can anyone advise?

demented hedgehog
  • 5,763
  • 2
  • 37
  • 43
Jman
  • 153
  • 1
  • 8

2 Answers2

20

I fixed this problem by deleting a Dialogflow agent associated with the project:

  1. Go to https://console.dialogflow.com
  2. Click on settings item in the top left (the cog icon next to the agent name)
  3. Confirm that this agent is in the project you are trying to delete. If it is not, select the agent that is in the project
  4. Click 'Delete this Agent' at the bottom of the page, and follow the instructions to delete the agent
  5. Try to delete the project again
demented hedgehog
  • 5,763
  • 2
  • 37
  • 43
Amit Kuckreja
  • 209
  • 2
  • 4
  • 4
    "Agent can not be deleted because agent is shared with other users" . What do I need to do to stop sharing the agent and deleting it? – asmaier Nov 29 '18 at 15:24
  • As per https://cloud.google.com/dialogflow/docs/agents-manage#delete : If more than one user has the Owner/Admin role, you must use the GCP Console to remove other users. Removing the other owners in the respective project will resolve the error. Here is how to remove them https://cloud.google.com/iam/docs/granting-changing-revoking-access#revoking-console – MonicaPC Mar 26 '20 at 23:12
11

Delete Dialogflow associated agent with the project as explained on previous solution.

If still failed, you could delete the project liens manually as follows:

  1. Go to Google Cloud Shell & Set to your project.

@cloudshell:~ ($project)$gcloud config set project [PROJECT_ID]

  1. Try to delete your project.
   @cloudshell:~ ($project)$ gcloud projects delete [PROJECT_ID]
   Your project will be deleted.

   Do you want to continue (Y/n)?  Y

   ERROR: (gcloud.projects.delete) FAILED_PRECONDITION: active child resource
   - '@type':type.googleapis.com/google.rpc.PreconditionFailure violations:
    description: active child resource
     subject: services/$service
   - '@type':type.googleapis.com/google.rpc.ResourceInfo
     resourceName: projects/$project
     resourceType: PROJECT
  1. List Project liens
   @cloudshell:~ ($project)$gcloud alpha resource-manager liens list

   NAME                                                  ORIGIN            REASON
   p1061081023732-l3d8032b3-ea2c-4683-ad48-5ca23ddd00e7  user@example.com  testing
  1. Delete Project liens

@cloudshell:~ ($project)$gcloud alpha resource-manager liens delete [LIEN_NAME]

  1. Then again delete Project

@cloudshell:~ ($project)$ gcloud projects delete [PROJECT_ID]

The project should be deleted right now.

Yugo Gautomo
  • 351
  • 3
  • 5
  • 2
    The command line route was required for me, since the agent was already deleted, even though GCP's project page insisted the agent needed to be deleted (the lien still existed). So, something went out of sync on their end. Other errors that will crop up (to help folks find this page) are "**Agent not found**" and then "**IAM permission 'dialogflow.agents.get' on 'projects/xxxxxxxxxxx' denied**" when hitting main Dialogflow page. – chunk_split Sep 09 '20 at 03:10
  • Really Helpful !! Deleted project successfully. – iksheth May 16 '21 at 18:39