The error message was pretty clear and reported my standard error handler as the dialog flow state the error happens. Apparently, the user message my standard error handler passes to a custom component contained invalid characters.
If you look at the error message, you can see that the last user message is actually a JSON payload, not a string. The JSON payload actually contained a lot of double quotes, which actually seems to confuse the BotML. Don't ask me how the JSON payload got in, but this also is what made it unexpected.
On my journey to find a fix, I came a cross a specific Apache FreeMarker expression that does not try to understand the message it passes but treat it as a raw payload. The dialog flow state below shows the original dialog flow definition. As you see for the Last user message property, it accessed the last user input and passed it to the custom component. Read the complete article here.
For regular information become a member in the Developer Partner Community please register here.