IBM Support

"Uniqueness constraint violation" problem during wkc-post-intall-init-pod processing

Troubleshooting


Problem

Modification of name of predefined data classes may lead to "Uniqueness constraint violation" problems during wkc-post-install-init job processing.
The wkc-post-install-init job may be triggered in situation involving upgrade or changes in installed WKC components.

Symptom

The wkc-post-install-init job does not finish successfuly and the pod logs contain error similar to:
ERROR: v3/glossary_terms/admin/initialize_content call did not return 200 http code, instead it returned : 409

ERROR: Output was: { "trace": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "errors": [ { "code": "conflict", "message": "WKCBG2352E: Uniqueness constraint for type data_class was violated. WKCBG0001I: Need more help? Contact us with this support ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx." } ] }"

Cause

wkc-post-install-init job creates or fills missing predefined data classes. Modification of name of predefined data classes, leads wkc-post-install-init to identify the data class as missing and it tries to insert it again. However each data class has unique Dataclass Id included in data class definition, therefore the attempt to add another data class with the same Dataclass Id will lead to  "Uniqueness constraint violation".
The wkc-post-install-init job can be triggered in multiple scenarios regarding modification of WKC platform components (it doesn't have to include any changes to component storing the data classes (glossary service)). The scenarios may include:
  • Upgrade of WKC to a new version
  • Manual components modifications using cpd_cli, e.g. ./cpd-cli manage update-cr --component=wkc ...

Resolving The Problem

To solve the problem, revert the name change of the predefined data class.
You may use the list of predefined data classes to help you in finding the changed one: https://www.ibm.com/docs/en/cloud-paks/cp-data/4.6.x?topic=classes-predefined-data-details
If you want to change the predefined data class, it is recommended to create a copy of it:
  1. either manually in the UI (the manually created data classes have random Dataclass Id which is ensured to be unique),
  2. or by using CSV export (modifying the file with new names and reimporting it)
    • IMPORTANT: when changing by csv export, change the Dataclass Id in definition column in each row. It looks e.g. like this: <DataClass id="USZC"
NOTE: If you are importing WKC Knowledge Accelerators, be aware that these also create a separate category hierarchy to manage both the out of the box data classes and additional industry-specific Knowledge Accelerator data classes. In this case it is advised to use or customize this Knowledge Accelerators Data Class category structure for the specific needs of your organization.

Related Information

Document Location

Worldwide

Example 1. How to manually add a data class:
newdc
copy2
Example 2. How to export/import data classes:
export
editeddcs
changedid
catdc
obraz
obraz

[{"Type":"MASTER","Line of Business":{"code":"LOB10","label":"Data and AI"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"DSXDOC","label":"IBM Watson Studio and Knowledge Catalog"},"ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions"}]

Document Information

Modified date:
31 May 2023

UID

ibm16989639