The registry with the name .. can’t be deleted because it’s not empty – Google Cloud


When deleting device registry, verify that there are no devices in the registry. Otherwise, Google Cloud API returns an error.

IoT Cloud Tester  application will return this error when trying to delete a registry that has devices.

In the below example, registry 'reg_702539' has devices, so error message is returned by Google Cloud when trying to delete that registry.

Following error message is returned by Google Cloud API.

DELETE https://cloudiot.googleapis.com/v1/projects/second-inquiry-315605/locations/asia-east1/registries/reg_702539

{

"code" : 400,

"errors" : [ {

"domain" : "global",

"message" : "The registry with the name 'projects/second-inquiry-315605/locations/asia-east1/registries/reg_702539' can't be deleted because it's not empty.",

"reason" : "failedPrecondition"

} ],

"message" : "The registry with the name 'projects/second-inquiry-315605/locations/asia-east1/registries/reg_702539' can't be deleted because it's not empty.",

"status" : "FAILED_PRECONDITION"

}

To fix this error,

  • Delete devices within the registry and then delete the registry.