diff --git a/pyopencl/scan.py b/pyopencl/scan.py
index 17d2de3f213edfb74f20fd001dc34496490fa05e..c814d87258c12d7a7a9a2c3039b2854727a2b2e7 100644
--- a/pyopencl/scan.py
+++ b/pyopencl/scan.py
@@ -1246,8 +1246,8 @@ class GenericScanKernel(_GenericScanKernelBase):
         queue = kwargs.get("queue")
 
         if len(args) != len(self.parsed_args):
-            raise TypeError("invalid number of arguments in "
-                    "custom-arguments mode")
+            raise TypeError("expected %d arguments, got %d" %
+                    (len(self.parsed_args), len(args)))
 
         first_array = args[self.first_array_idx]
         allocator = allocator or first_array.allocator
@@ -1425,8 +1425,8 @@ class GenericDebugScanKernel(_GenericScanKernelBase):
         queue = kwargs.get("queue")
 
         if len(args) != len(self.parsed_args):
-            raise TypeError("invalid number of arguments in "
-                    "custom-arguments mode")
+            raise TypeError("expected %d arguments, got %d" %
+                    (len(self.parsed_args), len(args)))
 
         first_array = args[self.first_array_idx]
         allocator = allocator or first_array.allocator