diff --git a/mercurial/hg.py b/mercurial/hg.py
index 201115f2859b91ec7019c1e468b14367feebe9cc_bWVyY3VyaWFsL2hnLnB5..e6d6497a6331cbb1e01c1b717cf01ee5a065b43b_bWVyY3VyaWFsL2hnLnB5 100644
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -933,9 +933,13 @@
     def branches(self, nodes):
         n = " ".join(map(hex, nodes))
         d = self.do_cmd("branches", nodes=n).read()
-        br = [ tuple(map(bin, b.split(" "))) for b in d.splitlines() ]
-        return br
+        try:
+            br = [ tuple(map(bin, b.split(" "))) for b in d.splitlines() ]
+            return br
+        except:
+            self.ui.warn("unexpected response:\n" + d[:400] + "\n...\n")
+            raise
 
     def between(self, pairs):
         n = "\n".join(["-".join(map(hex, p)) for p in pairs])
         d = self.do_cmd("between", pairs=n).read()
@@ -938,9 +942,13 @@
 
     def between(self, pairs):
         n = "\n".join(["-".join(map(hex, p)) for p in pairs])
         d = self.do_cmd("between", pairs=n).read()
-        p = [ l and map(bin, l.split(" ")) or [] for l in d.splitlines() ]
-        return p
+        try:
+            p = [ l and map(bin, l.split(" ")) or [] for l in d.splitlines() ]
+            return p
+        except:
+            self.ui.warn("unexpected response:\n" + d[:400] + "\n...\n")
+            raise
 
     def changegroup(self, nodes):
         n = " ".join(map(hex, nodes))