Sync Error in DHIS2 Android Capture When Updating Dependents of a Calculated Value Attribute

DHIS2 Android Capture v30 brings several new features and improvements. However, there are a few critical issues that need to be addressed to ensure a seamless user experience.

One notable problem arises when updating attributes of a tracked entity that have already been synced. Specifically, attributes with calculated values dependent on updated fields trigger sync errors. For instance, if a client’s demographic data includes an attribute like “Age” calculated from the “DOB” attribute, any updates or corrections to the DOB cause sync errors due to the mismatch between the new calculated value and the previously synced value. This issue also extends to other calculated fields, such as “UID”, “Fullname,” derived from a combination of “Firstname,” “Lastname,” and other attributes .

The error message encountered reads: “Generated by Program rule, unable to assign value to attribute. The provided value must be empty or match the calculated value.” This suggests that the app does not handle recalculated values effectively, leading to inconsistencies and sync failures.

It’s important to note that these issues do not occur when using the web API, indicating that the problem is specific to the Android app.

Addressing the sync errors for calculated attributes is crucial for users who rely on accurate and up-to-date data. We hope to see this issue resolved in future updates to enhance the app’s reliability and functionality.

1 Like

Hi @gmajaha I am sorry about the problems you are experiencing, we are currently looking into this issue. We have been able to replicate it and are pinpointing the origin of the problem.

We’ll get back to you as soon as possible.

3 Likes

Hello again @gmajaha

We were able to replicate the issue and it is certainly not the expected behaviour. We found the problem origin to be from an API request that fails initial sync en versions 2.40 or greater. The values are being updated in the app correctly.
I have contacted the API team and confirmed with them that it is a bug. They transmitted that it will be addressed in the next minor patch.

In our replication of the error we found that an immediate sync right after the first unsuccessful one would sync correctly.

Obviously this is not ideal and not the expected behavior but maybe it could be a workaround until the fix comes out.

Let us know if there is anything else we can help you with! :slightly_smiling_face:

1 Like

@Xavi

Thank you for the swift response and for the efforts in replicating and acknowledging the issue. It’s reassuring to know that the problem has been identified and that a fix is anticipated in the next minor patch,

Looking forward to the upcoming update :pray:

I would also like to report a few additional concerns we’ve encountered since upgrading to version 2.40 when we are sync data through Android Capture app :

:x:* Sync Errors with Mandatory Data Elements: We are encountering sync errors related to the enforcement of mandatory data elements through program rules. The error message displayed is: “Generated by Program rule (‘program rule name’) - Mandatory DataElement ‘DataElement name’ is not present.”

Error1

:x:* Issues with Data Elements in Program Stages: There are similar errors concerning data elements that have been set as compulsory in program stages. The typical error reads: “Mandatory DataElement ‘DataElement name’ is not present.”

Error2

These errors occur inconsistently; in some instances, the system functions as expected, while in others, it fails. We have temporarily disabled the rules causing sync errors, but this is not a sustainable solution

:x:Event Reports - Export Issues: Additionally, When downloading CSV files from Event Reports, the columns are not ordered as arranged in the layout; they appear jumbled. This issue forces us to use the Line Listing app as a workaround. However, the workaround is limited, as any changes regarding specific periods or organizational units require adjustments in Events Reports first.

Regards

1 Like

Good morning @gmajaha,

Thanks for the detailed information, these two first issues you mention seem to be due to the same problem and has already been detected by the sdk team, and also pinpointed to an API bug in the new importer. This will also be fixed in the next minor patch in all core versions. You can track the proccess here:

The third issue you mention is web related is that correct? Unfortunately I don’t think I can help much with that, would you mind creating a new topic in the community with the details or a Jira issue?

Again we apologize for the problems you are experiencing when updating DHIS2, the new importer improves on the old one a lot for syncing large amounts of data and connectivity issues but as can be seen still needs to be fine-tuned for some specific configurations and usecases. Which, now that it is being used by more implementations, bugs are being detected and fixed :slightly_smiling_face:

You can track the next minor patch release for each DHIS2 core version here:

39.6

Target release date: August 8, 2024

See the list of fixes so far for this patch on Jira

40.5

Target release date: September 12, 2024

See the list of fixes so far for this patch on Jira

41.1

Target release date: August 22, 2024

See the list of fixes so far for this patch on Jira

Let us know if there is anything else we can help you with.

Regards

1 Like

Hello Xavi,

Thank you for the update and commitment to refining the system and addressing the bugs as they arise.

Regarding the third issue with the Event Reports’ CSV export, yes, it is web-related. I will follow your suggestion and create a new topic in the community forum.

Regards

1 Like

Hi @Xavi ,
I am able to find the Jira ticket related to the first “Mandatory DataElement is not present”, but I don’t see a Jira ticket related to the “Generated by Program rule” error. We are experiencing the later. Can you please confirm if that will be fixed?We have this error on 2.40.3 and Androind 2.9.1.

1 Like

Hi @kstankevitz ,

Yes, I can confirm it has already been tested and merged into develop for 39, 40 and 41 and will be available in the next DHIS2 core minor patch release.

Here is the Jira issue for the sync problem when there is a program rule that assigns of a TEI attribute to another https://dhis2.atlassian.net/browse/DHIS2-17681.

Regards,

1 Like

Thanks for your help. Do you know a timeline of when the patch with the fix would be released? We are unable to capture data right now, and the team is considering downgrading, which I do not recommend.

Hi @kstankevitz if you are using 2.40.3 you would have to update to 2.40.5 that is scheduled to be released on the September 12th.

It’s not ideal but in our replicated case a second sync after first failing one syncs successfully.

Don’t hesitate to reach out if there is anything else I can help you with.

Hi Xavier,
Could you please share where it is documented that all you have to do is sync a second time? That definitely does not resolve the issue for us, which makes me concerned the September fix will not address our issue.

Our issue is documented here: [DHIS2-17764] - Jira

Hi @kstankevitz, sorry for the late reply. We have looked into the issue and although we believe it is the same one and will be resolved in the next DHIS2 core release, in our replicated case we can sync the second time but we have detected some different behaviours depending on the server.

In order to ensure that all these issues with the new Tracker importer will be resolved in the next minor patch. We have created this issue to verify and try to find any other problems related to this.

You can track the issue here [ANDROAPP-6343] - Jira

Regards,

Hi @Xavi

Update April 2026:
Still experiencing this issue on:

  • DHIS2 Server: 2.40.10.0
  • Android Capture App: v3.3.1 (latest)
  • Android SDK: 1.13.1

The issue persists despite upgrading past the reported
fix versions (40.5+). Requesting re-investigation.

Hi @gmajaha, sorry for the late reply,

Could you provide us with more details regarding the kind of program rule that you are using?
Things like the rule evaluation condition and the type of value that is being assigned, are you assigning the value of a tracked entity attribute to another? a concatenation of values?

I have created a simple program rule to test this but could not replicate it in 2.40.10 or 2.40.11… we are aware that this is a recurring issue and are looking into it in order to find a robust solution as soon as possible. So any further details you could give us to help pinpoint the origin of the problem is greatly appreciated.

Sorry for the inconvenience and thank you in advance!

Regards,

Xavier

Hello Xavier,

Thank you for the follow-up.

Yes, I’ve attached screenshots of the program rule actions for reference. These mainly involve Assign Value actions, including:

  • Calculated attributes (e.g. Age derived from DOB)
  • Concatenations (e.g. Full Name from First Name + Last Name)
  • In some cases, values derived from multiple attributes

An important observation:

  • The initial sync of the TEI is always successful
  • The issue occurs after an update to a source field (e.g. DOB)
  • When the recalculated value (e.g. new Age) does not match the originally synced value, the subsequent sync fails with the validation error

So the problem seems to arise specifically during updates to dependent fields, not during initial creation.

Let me know if you need any additional details or a sample configuration to replicate.

Regards,

1 Like

Hi again @gmajaha, thank you for the detailed response and explanation, it helps a lot!
We have been able to replicate this and have created a Jira issue to address it. We will prioritize and refine it while we try to find a robust solution for this problem hopefully for this next patch (3.4.1). You can track it here

Regards,

Xavier

1 Like