{"record":{"id":"78d0b0aa1e3d9eb1","repo":"kubernetes/kops","slug":"error-describing-instance-d-v","errorCode":null,"errorMessage":"error describing instance %d: %v","messagePattern":"error describing instance (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/do/cloud.go","lineNumber":148,"sourceCode":"\treturn nil\n}\n\nfunc (c *doCloudImplementation) DeleteInstance(i *cloudinstances.CloudInstance) error {\n\tdropletID, err := strconv.Atoi(i.ID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to convert droplet ID to int: %s\", err)\n\t}\n\n\t_, _, err = c.Client.DropletActions.Shutdown(context.TODO(), dropletID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error stopping instance %d: %v\", dropletID, err)\n\t}\n\n\t// Wait for 5 min to stop the instance\n\tfor i := 0; i < 5; i++ {\n\t\tdroplet, _, err := c.Client.Droplets.Get(context.TODO(), dropletID)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error describing instance %d: %v\", dropletID, err)\n\t\t}\n\n\t\tklog.V(8).Infof(\"stopping DO instance %q, current Status: %q\", droplet, droplet.Status)\n\n\t\tif droplet.Status == \"off\" {\n\t\t\tbreak\n\t\t}\n\n\t\tif i == 5 {\n\t\t\treturn fmt.Errorf(\"fail to stop DO instance %v in 5 mins\", dropletID)\n\t\t}\n\n\t\ttime.Sleep(time.Minute * 1)\n\t}\n\n\t_, err = c.Client.Droplets.Delete(context.TODO(), dropletID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error stopping instance %d: %v\", dropletID, err)","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/do/cloud.go#L130-L166","documentation":"While waiting up to 5 minutes for the droplet to reach status 'off', DeleteInstance polls c.Client.Droplets.Get every minute. If a poll fails, kOps wraps the error as 'error describing instance <id>'. The deletion flow cannot confirm shutdown progress, so it fails.","triggerScenarios":"Droplets.Get returns an error during the 5-minute shutdown wait loop: droplet was deleted out-of-band mid-poll (DO returns 404), DO API auth/token failure, transient DO API outage or rate limiting between polls.","commonSituations":"User deleted the droplet manually while a rolling update was in flight; API token revoked mid-operation; DO status page incident; heavy rate limiting from many concurrent deletes.","solutions":["Check whether the droplet still exists (doctl compute droplet get <id>); if deleted externally, refresh state with `kops update cluster` and re-run","Verify API token validity and scopes for the duration of the operation","Retry the rolling update after transient DO API issues resolve","Avoid manual droplet deletion during kOps rolling operations; use kops as the single writer"],"exampleFix":"// before\n# droplet deleted manually mid rolling-update -> Get() 404\n// after\nkops update cluster --name cluster.example.com --yes   # resync cloud state\nkops rolling-update cluster --name cluster.example.com --yes","handlingStrategy":"try-catch","validationCode":"_, _, err := client.Droplets.Get(ctx, dropletID)\nif err != nil {\n    return fmt.Errorf(\"droplet %d not describable; aborting shutdown wait\", dropletID)\n}","typeGuard":null,"tryCatchPattern":"droplet, _, err := c.Client.Droplets.Get(ctx, dropletID)\nif err != nil {\n    if gErr, ok := err.(godo.ErrorResponse); ok && gErr.Response.StatusCode == 404 {\n        break // deleted externally; proceed\n    }\n    return fmt.Errorf(\"error describing instance %d: %v\", dropletID, err)\n}","preventionTips":["Treat 404 during the wait loop as success (droplet already gone)","Keep API tokens valid for the full 5-minute wait window","Avoid manual console deletion during rolling updates","Add retry/backoff around poll failures for transient API errors"],"tags":["digitalocean","api-error","instance-lifecycle"],"backgroundTag":"instance-describe-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}