Unable to create events after upgrade from 2.33 to 2.35.1

Hey all - This is usually a sign that your database somehow ended up with several categorycombinations named ‘default’:

select * from categorycombo where name = ‘default’;

Hopefully only one of the categorycombos are being used, and the others can be deleted or renamed. This job requires a bit of dhis2 database knowledge, and it is important to test the approach on a database copy, or at least keep a backup.

If any categorycombos are completely unused, a simple delete SQL will remove them. If you are lucky, all but one of the categorycombos can be deleted. As long as your database has the normal foreign key constraints defined, you could try and delete the categorycombos named ‘default’ one by one - and the foreign key constraint would prevent you from deleting the ‘default’ categor(ies) that is used in your database.

In case multiple categorycombos with the default name that cannot be deleted, the job becomes a bit more involved - but let us see if this problem is in your database before trying to solve it.

Markus

4 Likes

Thank you very much @Markus for suggesting this. Let me try, I will give feedback

1 Like
  1. Delete failed on categorycombo table
    Complained about foreign key on categorycombos_categories
    Then traced the relationship between the two, and deleted referenced ID in second table
  2. Delete failed again on categorycombo table
    Complained about foreign key on categorycombos_optioncombos
    Then traced the relationship between the 2 tables, then deleted referenced ID in this table. But failed due to referenced ID in dataapproval table.
    That is when I checked if I am still having a problem, then boom! Problem solved.!!!
    So, problem was solved by deleting ‘default’ id on categorycombos_categories table.
1 Like

I’m so glad to hear that! I marked the post by Markus as Solution - thank you! (:

Very much appreciated @Gassim and @Markus. The But let us wait for @moses_mwale to confirm whether this solved his problem

1 Like

Sure, and really thanks to @Markus and you too! :smiley: Yes, I hope it will be solved for @moses_mwale . BTW, at the sametime there was a similar topic with the same issue and it has been solved (Could not save event DHIS2 2.36.3 - Event Capture App - #4 by Markus). I didn’t know it was the same thing until @Markus answered :grin:

@Gassim while @mmpeete 's solution solves the capture problem it creates a similar problem for the aggregate side “data entry”. when we check the database back before the “default” categoryCombos_categories was deleted we actually had just one “default”. we started experiencing this problem when upgraded from version 2.30 >> 2.31 >>2.32 >> 2.33 >> 2.34 >>2.35 (where we currently are).

I have one default and the issue still persists. Perhaps I have to dig a little bit deeper.
According to @moeketse if I delete this only default, It will resolve the capture and create the aggregate problem because the datasets depend on this default combo. Am I right?

I hope it doesn’t cause issues as you said because I believe while deleting we’re deleting the unused category combinations and relaying on the foreign key constraints to keep us from deleting ‘default’ categor(ies) that are being used.

@moses_mwale it seems that this solution is only for when :

So if you have only one categorycombination named ‘default’ then you are right maybe there’s a different approach? @Markus

Hello @moses_mwale. can you check , from app levell, how many "default"s do you have in Category Option combiniation. I had 3 of them. If you have more than 1, you may need to get into database and find a way to delete 2 that are not linked to other tables (especially datavalue). Mr @moeketse is right, if you manage to delete default in categorycombo table, you probably going to encounter problems. That is why we need to use dev/test db and instance.

Hello @mmpeete
this worked for me, I overlooked the frontend check. I found 4 of the catoptcombo. After deleting the 3 and remained with one. Event capture worked and aggregated entry worked too. Thank you.

2 Likes

You are welcome. Let us also wait for the reporting circle to complete. Then we shall be sure that this is 100% solution if no users luanch complaints.

1 Like

Hi
Iam facing the same issues and followed the @Markus solution and i found one categorycombo with default name but pk is preventing from deleting

1 Like

Yes, I think that’s supposed to happen. This solution is for when as @Markus puts it:

it should prevent you from deleting the one used by the DB;

Hello team,

I have this error when I launch the event from my tracker … how will he fix it
this error is : “Erreur dans la création de l’évènement
Incorrect result size: expected 1, actual 2”

Thanks

May you please share screenshots of the issue with the Network tab, and if it’s possible share the Tomcat log (without including sensitive info)? You might also try to clear the browser cache, and use the Data Administration app to make sure you don’t have any issues with your database. Thanks!

Please also include the version of the DHIS2 instance that you are using. (:


I am not admin for the server… just super user in dhis2.

Thanks for your help

Help please, have you a solution for this problem.

Thank you

We can ask the developers for support but we need to give them more info to understand the situation.

Please what is the version of the DHIS2 instance that you are using? And would you please take a screenshot of the Network tab (F12 → Network) see if there’s a red line and click on it and take a screenshot. Thank you!

Hello @Gassim,

Our instance DHIS2 is 2.36.3

Thanks

Okay, I searched in the previous CoP posts, and found this topic which is exactly the same as the issue you are facing so I will move this topic. I know you said you are not admin in the server but to solve this issue you will probably need access to the database. Please read the instructions by @Markus and see if it solves the issue: