It turns out this error is caused by a non-ascii character in a prologue section of the email. When the message gets parsed into a mailman.email.message.Message objectand then flattened to a string, the non-ascii in the prologue gets converted to unicode surrogates which causes problems in subsequent processing. The bug report has moved twice in the process of diagnosing and fixing this - from https://gitlab.com/mailman/hyperkitty/-/issues/301 to https://gitlab.com/mailman/mailman-hyperkitty/-/issues/25 to https://gitlab.com/mailman/mailman/-/issues/732 The fix is in core and is quite simple. ``` --- a/src/mailman/email/message.py +++ b/src/mailman/email/message.py @@ -55,7 +55,8 @@ class Message(email.message.Message): except (KeyError, LookupError, UnicodeEncodeError): value = email.message.Message.as_bytes(self).decode( 'ascii', 'replace') - return value + # Also ensure no unicode surrogates in the returned string. + return email.utils._sanitize(value) @property def sender(self): ``` See https://gitlab.com/mailman/mailman/-/merge_requests/665 -- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan