diff --git a/mercurial/revset.py b/mercurial/revset.py
index b1ebc767563d95db3dfff69a17f155a1f3fd93c0_bWVyY3VyaWFsL3JldnNldC5weQ==..104914b03b834d105f410c45d5486742758ade2f_bWVyY3VyaWFsL3JldnNldC5weQ== 100644
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2463,7 +2463,7 @@
         else:
             w = 1
         return w + wa, (op, x[1], ta)
-    return 1, x
+    raise ValueError('invalid operator %r' % op)
 
 def optimize(tree):
     _weight, newtree = _optimize(tree, small=True)