Bug - API DELETE container from ghcr.io broken

Hello, not sure when it broke, but I was using without an issue:
https://docs.github.com/en/rest/reference/packages#delete-a-package-version-for-the-authenticated-user

For example my versions look like this:

[
    {
        "id": 144,
        "name": "sha256:c65058fa7519270.............",
        ....
        "metadata": {
            "package_type": "container",
            "container": {
                "tags": [
                    "latest"
                ]
            }
        }
    },
    {
        "id": 123,
        "name": "sha256:d3c4f........",
        .....
        "metadata": {
            "package_type": "container",
            "container": {
                "tags": []
            }
        }
    }
]

And when I try to delete the old untagged version:

DELETE /user/packages/container/xxxx/versions/123

I get the error:

{
    "message": "You cannot delete the last tagged version of a package. You must delete the package instead.",
    "documentation_url": "https://docs.github.com/rest/reference/packages#delete-a-package-version-for-the-authenticated-user"
}

Obviously I do not try to delete the last tagged version.
Also the same error seems to occur if I randomize the ID to a non existing.
^ Improved error message would be nice.

Can someone tell me if this is a Bug, or did I miss some change?
I know it worked a few weeks/months ago.
Manually using the UI still works just fine but the API seems broken.

Best regards
Patrick

Thank you very much for reporting this bug. I have pushed up a fix for it. Please let me know if there are any further issues.

1 Like

Works again :tada:
Also thanks for improving the output message.

1 Like