diff --git a/lib/rapi/baserlib.py b/lib/rapi/baserlib.py
index fb4c48e77a731191764393cfce89bc3d7d530c7e..0361e474030de07ed676c3a2870e09dc6e0bc22b 100644
--- a/lib/rapi/baserlib.py
+++ b/lib/rapi/baserlib.py
@@ -195,6 +195,20 @@ def SubmitJob(op, cl=None):
     raise http.HttpGatewayTimeout("Timeout while talking to the master"
                                   " daemon. Error: %s" % str(err))
 
+
+def HandleItemQueryErrors(fn, *args, **kwargs):
+  """Converts errors when querying a single item.
+
+  """
+  try:
+    return fn(*args, **kwargs)
+  except errors.OpPrereqError, err:
+    if len(err.args) == 2 and err.args[1] == errors.ECODE_NOENT:
+      raise http.HttpNotFound()
+
+    raise
+
+
 def GetClient():
   """Geric wrapper for luxi.Client(), for better http compatiblity.
 
diff --git a/lib/rapi/rlib2.py b/lib/rapi/rlib2.py
index 9275a8039e56c7b4d72413517001a970b76ea544..e15546e8abca5365635af10d4ab0f1444cafe102 100644
--- a/lib/rapi/rlib2.py
+++ b/lib/rapi/rlib2.py
@@ -312,8 +312,10 @@ class R_2_nodes_name(baserlib.R_Generic):
     """
     node_name = self.items[0]
     client = baserlib.GetClient()
-    result = client.QueryNodes(names=[node_name], fields=N_FIELDS,
-                               use_locking=self.useLocking())
+
+    result = baserlib.HandleItemQueryErrors(client.QueryNodes,
+                                            names=[node_name], fields=N_FIELDS,
+                                            use_locking=self.useLocking())
 
     return baserlib.MapFields(N_FIELDS, result[0])
 
@@ -699,8 +701,11 @@ class R_2_instances_name(baserlib.R_Generic):
     """
     client = baserlib.GetClient()
     instance_name = self.items[0]
-    result = client.QueryInstances(names=[instance_name], fields=I_FIELDS,
-                                   use_locking=self.useLocking())
+
+    result = baserlib.HandleItemQueryErrors(client.QueryInstances,
+                                            names=[instance_name],
+                                            fields=I_FIELDS,
+                                            use_locking=self.useLocking())
 
     return baserlib.MapFields(I_FIELDS, result[0])