I am trying to migrate metadata from my old Platform 1.9.3 to my newly installed Platform 1.11.5 using the Metadata Sharing Module. When importing a package I am always getting this error:
type Exception report
description The server encountered an internal error that prevented it from fulfilling this request.
I also tried importing metadata having Hibernate Compatibility Module installed, but it was still unsuccessful.
Both Metadata Mapping and Metadata Sharing modules are up to date in both installations.
I tried importing forms from 1.9.3 to 1.10.3. Some could not be imported, because of problems with particular concepts like ‘yes’ or ‘no’. I am getting errors like this when importing forms containing these concepts:
Caused by: org.openmrs.api.APIException: ‘1067’ failed to validate with reason: Only one preferred name is allowed for each locale, Only one fully specifies name is allowed for each locale
Trying to (re)save the affected concept under dictionary, yields the same error. I checked the fully specified name and synonyms for each locale and can confirm that none are the same. The error also happens, if I choose ‘Merge (prefer mine)’ when importing.
There are same names for the locale ‘en’ which are also both preferred ones. I deleted these entries (also deleting the respective entry from concept_word table). Now when trying to import a form which is using this concept, it still fails when it tries to save the respective concept without detailed exception specification. Trying to (re)save the concept under dictionary yields a ‘query did not return unique result error: 2’ error.
I am using a freshly installed Platform 1.10.3 with the original, non-modified DB with demo data.
I could actually solve the problem for 1065 and 1066 by modifying the locale in the DB (changing it from ‘en’ to ‘en_US’ and ‘en_GB’ respectively). The problem also occurs with 5087 (‘pulse’). Changing locales in the DB in a similar way enables saving the concept in the dictionary, but during metadata import I am getting the ‘query did not return a result: 2’ error.
I should have explained the rules better. Only 1 unvoided preferred name is allowed for each locale. Case doesn’t matter. I should have added the voided field to the query. Your results show 2 preferred names for ‘en’ – ‘UNKNOWN’ and ‘Unknown’. Maybe one is already voided. 2 preferred names will not be validated during metadata sharing. Best to change the locale_preferred instead of changing the locale.
Try using this query to confirm voided status:
select concept_name_id,name, locale, locale_preferred
where concept_id = 1067
and voided = 0
order by locale;
Now when trying to save the concept under dictionary and also during metadata import, it does not complain about the preferred locale anymore, but still throws an error saying that only one fully specified name is allowed.
Changing the locale of ‘Unknown’ to ‘en_GB’ solves the problem, but metadata import still gets stuck on 5087 (‘Pulse’).
Try adding a few more useful and informational fields to your query:
select concept_name_id,name,locale,voided,locale_preferred,concept_name_type from concept_name
There should be 1 FULLY_SPECIFIED name per locale; 1 locale_preferred = 1 per locale. Changing the locale might solve some of the issues, but it’s not the correct use of the data model. It is meant for things like “center” (en) vs “centre” (en_gb).