Comment 14 for bug 1799406

Confirmed that changing:

reason = (_('Event <id=%(id)s,event_type=%(event_type)s> hits the '
                    'query <query=%(alarm_query)s>.') %
                  {'id': event.id,
                   'event_type': event.get_value('event_type'),
                   'alarm_query': json.dumps(alarm.obj.rule['query'],
                                             sort_keys=True)})

to:

reason = (('Event <id=%(id)s,event_type=%(event_type)s> hits the '
                    'query <query=%(alarm_query)s>.') %
                  {'id': event.id,
                   'event_type': event.get_value('event_type'),
                   'alarm_query': json.dumps(alarm.obj.rule['query'],
                                             sort_keys=True)})

prevents the error. The call to escape_unicode(value) passes value with type(value)=<class 'str'>.