Can't delete project because of image which was deleted

I have a project I don’t need anymore. I couldn’t delete it because of a volume.

$ incus storage volume list local
+-------+------------------------------------------------------------------+-------------+--------------+---------+
| TYPE  |                               NAME                               | DESCRIPTION | CONTENT-TYPE | USED BY |
+-------+------------------------------------------------------------------+-------------+--------------+---------+
| image | f3b2b8acdf73e5a0758d00994e7582faa1769b10848a89937410f2e8f363ca30 |             | filesystem   | 1       |
+-------+------------------------------------------------------------------+-------------+--------------+---------+

So I deleted it. (I had to specify the type with the name.) It is now gone.

$ incus storage volume delete local f3b2b8acdf73e5a0758d00994e7582faa1769b10848a89937410f2e8f363ca30
Error: Storage pool volume not found

$ incus storage volume delete local image/f3b2b8acdf73e5a0758d00994e7582faa1769b10848a89937410f2e8f363ca30
Storage volume f3b2b8acdf73e5a0758d00994e7582faa1769b10848a89937410f2e8f363ca30 deleted

$ incus storage volume list local
+------+------+-------------+--------------+---------+
| TYPE | NAME | DESCRIPTION | CONTENT-TYPE | USED BY |
+------+------+-------------+--------------+---------+

But I still can’t delete the project:

$ incus project delete test
Error: Only empty projects can be removed.

It thinks the volume still exists even though I deleted it as show above:

$ incus project show test
config:
  features.images: "true"
  features.profiles: "true"
  features.storage.buckets: "true"
  features.storage.volumes: "true"
description: Experimenting
name: test
used_by:
  - /1.0/images/f3b2b8acdf73e5a0758d00994e7582faa1769b10848a89937410f2e8f363ca30?project=test
  - /1.0/profiles/default?project=test

What should I do to be able to delete the project?

I don’t think you should have been able to delete the volume in the first place; is that an error @stgraber?
In any case, your project is still referenced in two objects, which can be deleted with:

incus image delete f3b2b8acdf73e5a0758d00994e7582faa1769b10848a89937410f2e8f363ca30 --project=test
incus profile delete default --project=test

(I think you don’t actually need to delete the profile, but I don’t remember :slight_smile:)

Thank you Benjamin. That did indeed work.

We do allow image volumes to be deleted as that’s a way to clear the “optimized” version of an image (native zfs zvol, btrfs subvol, …) without deleting the image file itself.