diff --git a/pytools/__init__.py b/pytools/__init__.py
index bd654ea5e68ae613782bcbe2fcd5672b5a9e8895..2d4b465bf2fb86b33c3cf26fc8afd10eb20ca620 100644
--- a/pytools/__init__.py
+++ b/pytools/__init__.py
@@ -2178,7 +2178,8 @@ class UniqueNameGenerator:
         if self.is_name_conflicting(name):
             raise ValueError("name '%s' conflicts with existing names" % name)
         if not name.startswith(self.forced_prefix):
-            raise ValueError("name '%s' does not start with required prefix" % name)
+            raise ValueError("name '%s' does not start with required prefix '%s'"
+                             % (name, self.forced_prefix))
 
         self.existing_names.add(name)
         self._name_added(name)