Error editing some patient encounters

Hi everyone. I am getting an error when trying to edit some patient encounters/visits. The encounters have been created with xform. I am using oepnmrs 2.4.2 with xforms 4.3.12

https://pastebin.com/9VB1dji8 https://pastebin.com/pDDmidXx

What is the id associated with the provider for that encounter?

From encounter_provider table provider_id 175 is associated with this encounter_id 946750.

Do you have a non retired provider with that id?

No I don’t have that provider_id on provider table. I have try to run “SELECT e.encounter_id, e.provider_id, p.provider_id, p.person_id FROM encounter_provider e left join provider p on e.provider_id=p.provider_id where encounter_id=946750;” and the results are “encounter_id=946750 e.provider_id=175 p.provider_id=null p.person_id=null”.

Replace the provider id with one that exists and see if you can load the encounter.

Thank you very much now I can edit encounter. I think this also help a little bit on my other problem because I can see encounters of this patient Patient dashboard visits/encounters does not display encounters of some patients.

But where did the system get these provider ids because the id is 175 and from the provider if the last one 60. Does this mean there were several after 60 that are deleted?

That is one of the possibilities.