Delete on table "app_template" violates foreign key constraint "fk_catalog_item2app_template" error when removing an application template in VMware Cloud Director
search cancel

Delete on table "app_template" violates foreign key constraint "fk_catalog_item2app_template" error when removing an application template in VMware Cloud Director

book

Article ID: 438198

calendar_today

Updated On:

Products

VMware Cloud Director

Issue/Introduction

  • When removing and organization, an error similar to the following occurs:

    null id in com.vmware.vcloud.common.model.event.AuditTrailEventModel entry (don't flush the Session after an exception occurs) - null id in com.vmware.vcloud.common.model.event.AuditTrailEventModel entry (don't flush the Session after an exception occurs)"

  • Attempting to remove an application template associated with a remaining catalog item in the organization results in an error similar to the following:

    could not execute update query - ERROR: update or delete on table "app_template" violates foreign key constraint "fk_catalog_item2app_template" on table "catalog_item" Detail: Key (id)=(########-####-####-####-############) is still referenced from table "catalog_item"

Environment

VMware Cloud Director 10.5.x

Cause

As discussed in the following article, the existence of an application template in the organization prevents the organization from being removed and results in errors similar to the one above:

Error: "null id in com.vmware.vcloud.common.model.event.AuditTrailEventModel entry (don't flush the Session after an exception occurs)" trying to delete an Org VDC in VMware Cloud Director

In this situation, there is a catalog item that still points to the application template, which is causing the removal of the application template from being successful due to a database constraint.

Resolution

Contact Broadcom Technical Support and reference this Article ID (438198) in the problem description to resolve this issue. For more information on creating a request, refer to the following:

Creating and managing Broadcom support cases

Upload a backup of the database to the case when it is opened:

Back Up the Embedded Database of Your VMware Cloud Director Appliance

Put the error message in the case Description.