Cryptic errors from REST API

I’m using reference app 12.2, posting new encounters for the first time. Whenever there is a validation error, OpenMRS just returns a very cryptic message like:

Request processing failed; nested exception is observations on class org.openmrs.Encounter


… the same ConversionException with: encounterDatetime on class org.openmrs.Encounter

So, after trial and error on the 2nd one, it seems OpenMRS doesn’t like microseconds in the date format. I’m still trying to figure out what is wrong with the 1st one, the observations in the encounter, since the error message is of no help. Also nothing in the logs.

Can this error reporting be improved, it’s hard to make progress at the moment?

Feel free to create a ticket for this.

I have an OpenMRS ID (login), but can’t log into JIRA. Who can I contact to give me JIRA access?

Another case of deficient error reporting for encounter/observation:

The obs has value=6, for a ConceptNumeric with low_absolute=0, hi_absolute=5.

In the OpenMRS log, I can see the correct error:

org.openmrs.api.ValidationException: 'obs id is null' failed to validate with reason: valueNumeric: error.outOfRange.high

However, the exception that is returned to the caller is 100% unusable. It looks like an exception in the exception handler, so the message is unusable:

No serializer found for class org.springframework.validation.DefaultMessageCodesResolver and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: org.openmrs.api.ValidationException['errors']->org.springframework.validation.BindException['bindingResult']->org.springframework.validation.BeanPropertyBindingResult['messageCodesResolver'])

OpenMRS help desk: Help Desk - Resources - OpenMRS Wiki

Issue RESTWS-899 logged on JIRA here.

Thanks @dkayiwa, I saw on JIRA RESTWS-899 that at least one error was fixed. My Rest Web Services OMOD version is, running under ref app 2.12. How do I upgrade to 2.34?

Upgrade to the latest which is version 2.36.0

I have upgraded the module to 2.36, but now I have database compatibility issues. I guess there are Liquibase changesets to run to migrate 2.32 to 2.36? What is the recommended way of doing this ? Can I get the list of changeset XML files somewhere?

The REST module doesn’t make use of liquibase. Can you describe the “database compatibility issues” you are seeing?

Yeah, I also found it strange that the REST API would require db changes. I sort of assumed that the newer version of the REST API triggered different code paths in OpenMRS core, and that those paths required db updates.

Unfortunately, I have reverted to version 2.32 because of the errors I was seeing, and I didn’t record the exact error message. It was along the lines of not finding some lookup value with name “ZZ”. I then looked for any reference to “ZZ” in the Liquibase snapshots from my reference application, and found column concept_datatype.hl7_abbreviation assigned that value, so I assumed it had something to do with changesets. I might be wrong, though…

From liquibase-core-data-2.3.x.xml:

<insert tableName="concept_datatype">
	<column name="concept_datatype_id" valueNumeric="11"/>
	<column name="name" value="Rule"/>
	<column name="hl7_abbreviation" value="ZZ"/>
	<column name="description" value="Value derived from other data"/>
	<column name="creator" valueNumeric="1"/>
	<column name="date_created" valueDate="2006-09-11T00:00:00"/>
	<column name="retired" valueBoolean="false"/>
	<column name="retired_by"/>
	<column name="date_retired"/>
	<column name="retire_reason"/>
	<column name="uuid" value="8d4a5e96-c2cc-11de-8d13-0010c6dffd0f"/>