Error on Metadata Sync


I need some help with the error on Data Sync. during the sync, the system throws an error related to data element reference to dataset (see the file error on sync). these are new datasets that are supposed to be sync from the parent server to the recipient ones.

on manually importing the datasets (using the import/export) the import of these datasets works fine with no errors. when trying to sync again (this time the sync will be updating instead of creating them) it throughs the same error. when inspecting the dataset from both the parent and recipient server, everything is fine and they are identical (error log on the file named error on sync after manual import).

hope I will get a reply soon.


Error on Sync.pdf (239.6 KB)Error on Sync after manual import.pdf (237.8 KB)

1 Like

Hi @yusuphk,

Which DHIS2 version are you using?

@Morten_Haugen has been working a lot with metadata import/export, maybe you can have a look?

Best regards,

Hello @yusuphk
I see your issue is quite old by now, perhaps you have been able to resolve it?

I have little experience with data synchronizing, but looking at your log output it seems the data being synced is missing some references to Data Elements:

ERROR: null value in column “dataelementid” violates not-null constraint
Detail: Failing row contains (138749219, null, null, 10110). ( [taskScheduler-11])
Caused by: org.postgresql.util.PSQLException: ERROR: null value in column “dataelementid” violates not-null constraint

I am assuming the data should be holding a reference to a Data Element UID that for some reason is missing in your source data.

Please feel free to report back if your issue remains or if you have managed to resolve it.

Morten Haugen

1 Like


Sorry, the message got lost in my inbox. Yes, I manage to resolve it. the problem was with the cached version that had a problem. so the first problem was with the reference, when I corrected the problem and re re-publish it, the sync did not work and kept giving back the same error. when I checked I found out that the published vesion which had the reference error was cached/ loaded to the child instance and it was refreshing that version hence it kept giving back the same error over and over again. so I manually removed that version from both parent and child instance and re-published and sync again, and it was ok.

thanks again.


1 Like

Hi everybody,
At WHO we have been working on an application to synchronize metadata (and data) from one to one or multiple other DHIS2 instances containing similar or different metadata. You may want to try it out! It synchronizes subsets of metadata and allows to schedule synchronizations of any subsets at regular intervals and between two or more DHIS2 instances.

The latest release is described here in case it helps: MetaData Sync app 2.2.0 now available