ERROR: The instance or operation is not in an appropriate state to handle the request
Asked Answered
P

2

7

Using Google Cloud SQL I was attempting to restore my main instance to a prior backup, but first I wanted to clone the instance for the tables and databases that I didn't want reverted. After waiting over an hour for the clone, I canceled out of the clone and attempted to delete the cloned instance. However, the clone is now stuck in Maintenance status and attempting to delete I get the following error.

mycomputer:~ myuser$ gcloud sql instances delete cloned
All of the instance data will be lost when the instance is deleted.

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

ERROR: (gcloud.sql.instances.delete) The instance or operation is not in an appropriate state to handle the request.

The instance was created with the following command and then just exited out with CTRL+C after waiting too long.

mycomputer:~ myuser$ gcloud sql instances clone main cloned
Cloning Cloud SQL instance.../ERROR: Caught socket error, retrying:[Errno 54] Connection reset by peer
ERROR: Caught socket error, retrying: [Errno 54] Connection reset by peer
Cloning Cloud SQL instance...|
Cloning Cloud SQL instance...\^C

Command killed by keyboard interrupt
Potentiate answered 29/4, 2015 at 20:45 Comment(2)
You could get in touch with [email protected] with your project id and instance name and the Cloud SQL team should be able to look into this.Choi
Thanks Jay Zhu next time I will reach out to google directly. After several hours it showed as runnable and I was able to delete. It appears to just take a lot of time. I would say that if it really takes that long to clone a small instance then it's not a very useful recovery option.Potentiate
S
5

I tried replicating this problem with the Cloud SQL API Explorer. I found this error message on a different thread initiated on the Google forums. The error message "The instance or operation is not in an appropriate state to handle the request" occurs when the same name for the instance is being used. Now it also made sense to me why, in the official documentation of Terraform, a random_id resource is created as database name suffix.

Subscription answered 17/10, 2019 at 7:43 Comment(3)
"occurs when the same name for the instance is being used", when the same name for the instance is being used where? Could you put this in context of the tutorial (cloud.google.com/sql/docs/postgres/quickstart) please? As i've just met this error whilst following this tutorial (at the step of "Connect to your instance using the psql client in Cloud Shell")Olympias
Follow up - in the case I've outlined above waiting ~10 minutes worked for me so I guess there was some server stuff being setup in the background.Olympias
@Olympias i have the same error. dont know how much you can recall this but mine just becomes disabled after doing the first bit of replication. After that i keep getting the error ""The instance or operation is not in an appropriate state to handle the request"" as aboveReena
O
1

I was getting this error while creating SQL instance in GCP with terraform

Error: Error, failed to create instance <name>: googleapi: Error 409: The instance or operation is not in an appropriate state to handle the request., invalidState

I was able to solve it by changing the SQL instance name in the conf and it worked like perfectly

Outcast answered 29/5, 2020 at 10:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.