Error when importing data into version 2.40.2-SNAPSHOT

Hi, DHIS2 Community @Gassim

Please I’m trying to import data into DHIS2 using Import/Export App, but I keep getting “Invalid UID for property DataElement error. I have imported the same file into versions 2.31 and it worked successfully.

I don’t know if it is a version issue, but some data elements in the JSON file imported successfully, only some few others have this issue. Has anyone experienced such issue and what can be a possible solution?

I don’t know if it is logical, but the only similarity in the errors is that a number precedes all the UIDs. Could that be a bug please??




@Rae,
It seems part of your DE/TEA or optionSets/options have not been imported properly. Open maintenance app and check for each DE/TEA if they exists.

Regards,

I imported the same dataset into version 2.31 and it worked fine. Also when I removed the numbers that precede the UIDs, the import worked. I think it’s a bug

Internally there are big differences between the version 2.31 and 2.40.
Try to export the dataset into 2.38 or 2.39. If it will work that will be fine too.

Hi @Rae,
My guess is this is related to your UIDs starting with numbers. I think it was changed at one point to not allow numbers at the start of UIDs (don’t quote me on that, but I have gotten errors before if I try to create an element with a UID that starts with a number).

My guess is that these data elements were not actually imported, as Ulanbek suggests. You can use the identifiable Objects endpoint to see if anything with those ids are in teh system (api/identifiableObjects/uid)

If they’re not, I would start by updating your uids and reimporting your metadata.

1 Like

@kstankevitz is correct. In previous versions of DHIS2, invalid UIDs were not validated. Any string consisting of 11 characters (even if it started with a number) was allowed to be assigned as a UID. This bug has been fixed. UIDs generated by DHIS2 have always started with a letter and followed 10 characters, but if an external script was used to generate these identifiers which begin with a number, in current versions of DHIS2 you will see that error.

Only solution is to change the UID to one which is valid.

Best regards,
Jason

1 Like