The thing is, the transformation is already done and dusted before the error-insert in the REST JSON e.g.
{"link":"http://openhabian:8080/rest/items/Onkyo_LivingRoom_Input","state":"17","transformedState":"Nvidia","stateDescription":{"pattern":"MAP(onkyo_source.map):%s","readOnly":false,"options":[{"value":"16","label":"CABLE"},{"value":"1","label":"ROKU"},{"value":"2","label":"GAME"},{"value":"17","label":"NVIDIA"},{"value":"5","label":"MAC Old"},{"value":"3","label":"AUX"},{"value":"37","label":"AM"},{"value":"36","label":"FM"},{"value":"35","label":"PHONO"},{"value":"18","label":"TV"},{"value":"34","label":"NOT USED"},{"value":"43","label":"NET"},{"value":"46","label":"BLUETOOTH"},{"value":"128","label":"Source"}]},"commandDescription":{"commandOptions":[{"command":"16","label":"CABLE"},{"command":"1","label":"ROKU"},{"command":"2","label":"GAME"},{"command":"17","label":"NVIDIA"},{"command":"5","label":"MAC Old"},{"command":"3","label":"AUX"},{"command":"37","label":"AM"},{"command":"36","label":"FM"},{"command":"35","label":"PHONO"},{"command":"18","label":"TV"},{"command":"34","label":"NOT"{\"error\":{\"message\":\"begin 0, end -1, length 12\",\"http-code\":500,\"exception\":{\"class\":\"java.lang.StringIndexOutOfBoundsException\",\"message\":\"begin 0, end -1, length 12\",\"localized-message\":\"begin 0, end -1, length 12\"}}}"
Note this time "transformedState":"Nvidia"
is all good, and the extraneous rubbish turns up partway through the list of command options
… {"command":"34","label":"NOT"{\"error\":{\"message\":
where I guess NOT should be NOT USED and as a command option has nothing to do with maps or transformations.
I don’t believe the error comes from the transformation, because that has completed and returned the expected answer. It’s something else about starting another asynchronous thread or taking more time when a transformation is invoked.
Is this entirely predictable? i.e. if you run the query twice with no changes, is it always the exact same point of failure? that would be more surprising than not, to me.