diff --git a/mercurial/error.py b/mercurial/error.py
index 4ebc5f325bedfc8fc98b3c41fda7892563142146_bWVyY3VyaWFsL2Vycm9yLnB5..bd5b2b29b82df1e2de214a59a8aa60eb80ee27f9_bWVyY3VyaWFsL2Vycm9yLnB5 100644
--- a/mercurial/error.py
+++ b/mercurial/error.py
@@ -73,7 +73,10 @@
             from .node import short
 
             name = short(name)
-        RevlogError.__init__(self, b'%s@%s: %s' % (index, name, message))
+        # if name is a binary node, it can be None
+        RevlogError.__init__(
+            self, b'%s@%s: %s' % (index, pycompat.bytestr(name), message)
+        )
 
     def __bytes__(self):
         return RevlogError.__bytes__(self)