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

Hello @Ulanbek @Gassim

I’m having this issue, but when I try to open the Capture app. We just recently upgraded to v 2.40.8, and I’m getting this error on the console when I try to open the app.
What could be the issue?

Hi @j.afo

Do you get this issue when you attempt the action mentioned at the top of the post “editing person profile”? Or simply when you navigate to the app?

Would you please try to update the app from the App Management app and then clear the browser cache (best if you try in Guest mode to avoid cache issues).

If you’re still seeing this issue, would you please check the log in the Network/Console tabs (F12 > DevTools).

Thanks!

I get the issue when I navigate to the app. Here’s the screenshot of my console.

1 Like

Okay, it seems that you are facing the same issue that @baktash.salehi faced above. Would you please check his notes and the suggested solution?

Thank you!

Dear All,
I installed the Capture app version 102.6.15 on platform version 2.39.7, and this error is showing:
The application could not be loaded. A possible reason for this is that the browser or mode (e.g. privacy mode) is not supported. See log for details.

please help me.

cc:
@Gassim

Hi @sami.oracle10g

Please see my comment above for the similar issue:

Hi all,

  1. If you have access to the program metadata in Maintenance, please update the version number of the program. This will refresh the cache.
  2. If you do not have access, refresh the IndexedDB manually. Go to Capture and:
  • Right click and choose “inspect” or press F12 (If in Chrome), then click “Application”
  • Then expand IndexedDB and right click and click “Refresh indexed DB” on all of them.

If you are still facing the issue after doing one of these, then please go to Console (Right click page and click Inspect or F12, then click Console) and take a screenshot of what you are seeing there. We need that to debug.

Thanks so much :blush:
Karoline
DHIS2 Product Manager

1 Like