Skip to main content
Seasoned ⭐️
Jun 27, 2023 11:22 AM UTC

[Bug] Label name and external_id fields are swithced

When creating Labels, the “external_id” and “name” fields are switched. I’ve previously reported this for C#. It turns out the error is also found in the Python SDK:


Repro steps

Replicating the bug is trivial. Consider the following code in Python:

label = LabelDefinition(external_id=”label_x”, name=”x”, data_set_id=DATASET_ID)
client.labels.create(label)


Use the label on an asset, and CDF will display “label_x” as the label name. The two fields are somehow swithced.


Persistance or display issue?

Ok, so is CDF just displaying the wrong field? It’s hard to tell due to other issues around labels, but consider this: As a fix, I chose to align the “external_id” and “name“ fields, landing on the something like this.:

label = LabelDefinition(external_id=”x”, name=”x”, data_set_id=DATASET_ID)
client.labels.create(label)


Resulting in an error

CogniteDuplicatedError: Duplicated: [{'externalId': 'x'}]
The API Failed to process some items.

2 replies

Dilini Fernando
Expert ⭐️⭐️⭐️⭐️
Expert ⭐️⭐️⭐️⭐️
Jun 27, 2023 1:55 PM UTC

Hi @Anders Nygaard,

I will create a Support ticket, so our team can follow up and help you.

Best regards,
Dilini 

Seasoned ⭐️
Jun 28, 2023 6:46 AM UTC

This issue might be related to