diff --git a/mercurial/wireprotoframing.py b/mercurial/wireprotoframing.py
index 69b4a5b89dc546db2b19bb452fdf1967ff98e7c5_bWVyY3VyaWFsL3dpcmVwcm90b2ZyYW1pbmcucHk=..bce1c1af7518e87a6b8ee0761d8976c4b75da1b1_bWVyY3VyaWFsL3dpcmVwcm90b2ZyYW1pbmcucHk= 100644
--- a/mercurial/wireprotoframing.py
+++ b/mercurial/wireprotoframing.py
@@ -827,9 +827,10 @@
                     break
 
                 except Exception as e:
-                    for frame in createerrorframe(stream, requestid,
-                                                  '%s' % e,
-                                                  errtype='server'):
+                    for frame in createerrorframe(
+                        stream, requestid, '%s' % stringutil.forcebytestr(e),
+                        errtype='server'):
+
                         yield frame
 
                     break