> For the complete documentation index, see [llms.txt](https://platform9.com/kb/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://platform9.com/kb/pmo/solution/instance-unable-to-be-deleted-stuck-in-spawning-build-state.md).

# Instance Unable to be Deleted, Stuck in Spawning/Build State

## Problem

* An instance is unable to be deleted and it's still showing in a spawning/build state.
* The following is observed in `/var/log/pf9/ostackhost.log` on the instance's hypervisor.

{% tabs %}
{% tab title="None" %}

```none
INFO nova.compute.manager [...] [instance: <UUID>] During hypervisor state sync the instance has a pending task (deleting), skipping
```

{% endtab %}
{% endtabs %}

## Environment

* Platform9 Managed OpenStack - v3.10 and Higher
* Nova

## Cause

The instance has another actively-running task which cannot be interrupted. For example, if the image is still being downloaded to the hypervisor and a deletion is issued, the image will continue being downloaded, and the deletion task will not be processed until afterward, or until the service is restarted.

{% tabs %}
{% tab title="None" %}

```none
INFO nova.virt.libvirt.driver [...] Creating image
INFO nova.compute.manager [...] During hypervisor state sync the instance has a pending task (spawning), skipping...
INFO nova.compute.manager [...] During hypervisor state sync the instance has a pending task (deleting), skipping
```

{% endtab %}
{% endtabs %}

## Resolution

1. Wait for the active task to complete.
2. Alternatively, or subsequently, should the task never complete, restart the `pf9-ostackhost` service on the hypervisor.

{% tabs %}
{% tab title="None" %}

```none
# systemctl restart pf9-ostackhost
```

{% endtab %}
{% endtabs %}

Afterward, the following should be observed in `/var/log/pf9/ostackhost.log` confirming the deletion.

{% tabs %}
{% tab title="None" %}

```none
INFO nova.compute.manager [...] [instance: <INSTANCE_UUID>] Service started deleting the instance during the previous run, but did not finish. Restarting the deletion now.
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://platform9.com/kb/pmo/solution/instance-unable-to-be-deleted-stuck-in-spawning-build-state.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
