Metadata deploy error when starting module


We are having this error when starting our custom module and we have records on drug_orders table on the database:

org.openmrs.api.CannotUpdateObjectInUseException: Order.frequency.cannot.edit

We have traced it back to this line:

Since OrderService has a validation that does not allow to update an OrderFrequency entity that is already in use by a DrugOrder. See:

Can you please give guidance on the best way to solve this problem?

We are using latest snapshot of reference application 2.9.

Thank you,


That looks like a problem in the metadatadeploy module. A quick fix would be for the metadatadeploy module to first check if the order frequency is in use, before attempting to save it.

1 Like

Hi @dkayiwa, we created this issue and submited a PR . Can you help with the merging?

I have put some comments on the pull request.

1 Like

Thank you @dkayiwa Just fixed the commit message.

Can you also claim the ticket and do the JIRA workflow as advised here?