Help Needed: Error 400 - Direct Self-Reference Leading to Cycle

Hello DHIS2 Community,

I’m reaching out to seek assistance with an error I’ve encountered while working on my DHIS2 tracker instance. The error message is as follows: “httpStatus”:“Bad Request”,“httpStatusCode”:400,“status”:“ERROR”,“message”:“Direct self-reference leading to cycle (through reference chain: org.hisp.dhis.program.Program[“relatedProgram”])”

This error seems to indicate a direct self-reference issue within the relatedProgram attribute of the Program object. Despite my efforts, I haven’t been able to resolve it and am seeking guidance from the community.

Has anyone experienced this issue before? If so, could you please share your insights or any steps you took to resolve it?

DHIS2 Version:
With limited Access to server side.


Hi @Curturamu ,

The error message suggest that your tracker program is in some sort of endless reference loop (self-reference).

Check the ‘Enrollment details’ section of your tracker program and if you have selected the ‘trackedentitytype’ in the Related program, remove it.

Screenshot from 2024-06-14 18-33-14

Hi Clement,

Thanks for the quick response,

That’s what I suspect as well, I forgot to mention that I am now unable to open the program to edit that part, Is there another way to edit it maybe via API or something?

Hi @Curturamu,

If you have access to the server/database, you can remove this related program and your app should work.

In the db, there’s a table called program where you’ll find this ‘related program’ field. If for the affected program, you have selected a related program, send a delete query to remove the value.

Unfortunately, I do not have direct access to the server or database. I will need to collaborate with someone on a different continent for that. I thought I could find a clever way around it.
Thank you.