diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 82bbdf958d8607ea998b8bcca43fa79e23433fb3..6c74eed2000e47d9bd8fa4abe75051e83929230c 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -4950,8 +4950,7 @@ class LUQueryInstanceData(NoHooksLU):
       for name in self.op.instances:
         full_name = self.cfg.ExpandInstanceName(name)
         if full_name is None:
-          raise errors.OpPrereqError("Instance '%s' not known" %
-                                     self.op.instance_name)
+          raise errors.OpPrereqError("Instance '%s' not known" % name)
         self.wanted_names.append(full_name)
       self.needed_locks[locking.LEVEL_INSTANCE] = self.wanted_names
     else: