Capture App Interface Not Loading After Upgrade to 2.41

Hi,

We have upgraded our instance from version 2.38 to 2.41, and everything is working as expected except for the ‘Capture’ app interface, which is not loading. Instead, we are seeing the message: “The application could not be loaded. Please see the log for details.” There are no errors in the Network tab, and all APIs are returning values as expected (see below). I have tried the latest version of the Capture app and version 100.35.0, but the issue persists.

Additionally, the Tracker Capture app is loading without any issues, and there are no errors logged in the DHIS2 or Tomcat log files. However, the following error appears in the console:
Error: ‘TypeError: Cannot read properties of null (reading ‘trackedEntityAttribute’)’

Has anyone else encountered this problem?


Hello @baktash.salehi

We recently had a similar issue, which was also accompanied by the inability to create program rules or edit one of the programs.

We realized the issue was that one of the programTrackedEntityAttribute had a value of null so we cleaned it out.

Here are the steps we took;

  1. Identifying the program with the issue:
    We used the programs API to check for the missing programTrackedEntityAttribute;
    /api/programs?fields=id,programTrackedEntityAttributes[id,sortOrder]
    And the response of one of the programs was like this
//Other programs
{
  "id": "program-id",
  "programTrackedEntityAttributes": [
    {
      "id": "id-1",
      "sortOrder": 1
    },
    {
      "id": "id-3",
      "sortOrder": 3
    },
    null,
    {
      "id": "id-2",
      "sortOrder": 4
    }
  ]
}

Apart from the null value, you will also notice that there is a sort order value that is skipped in the list. We took note of the missing value.

  1. Getting the program metadata
    We then got the problematic program metadata using the API api/programs/program-id/metadata and saved the resulting JSON into a file.

  2. Cleaning out the null value
    In the metadata file, we cleared out all metadata except program and programTrackedEntityAttributes. We then obtained an id from an existing trackedEntityAttribute in the system that is not assigned to this program. This will be used to replace the null value so that the sort order remains intact. We then generated a DHIS2 id value using the API /api/system/id?limit=1 We then replaced the null value with the new programtrackedEntityAttribute;

{
  "program": {
    //...Program meta
  },
  "programTrackedEntityAttribute": [
      //Other program tracked entity attributes
    {
      "id" : "generated-id-from-dhis2",
      "sortOrder": "missing-sort-order-as-number",
      "trackedEntityAttribute": {
        "id": "existing-tracked-entity-attribute"
      },
      "program": {
        "id": "program-id"
      }
    }
  ]
}

  1. Import the metadata file
    After the changes, we imported the metadata file using the import export app. After the import we then checked if the issue had been resolved. Once we concluded that it had been resolved, we removed the trackedEntityAttribute we just added through the maintenance app.

I hope this helps you as well.

Note: Since you are coming from an upgrade, there may be more than one affected program. I suggest you check all programs just to be sure.

Regards.

2 Likes

Thank you, @nnkogift, for the detailed step-by-step instructions. I will follow each step and provide updates here accordingly.

1 Like

Hi,

After the upgrade, an entity type ‘Tracked entity type attributes’ were not associated, which caused the capture app to throw a Null Reference. Exporting the tracked entity and tracked entity attribute from a backup to the upgraded server resolved the issue.

I wanted to share this in case anyone faces a similar issue in the future. Thank you, @nnkogift, for your proposed test. I started with it, and luckily, there was no null value for the tracked entity attribute.

Regards,
Baktash Salehi

2 Likes