Index: trunk/Nebulous/lib/Nebulous/Client.pm
===================================================================
--- trunk/Nebulous/lib/Nebulous/Client.pm	(revision 24930)
+++ trunk/Nebulous/lib/Nebulous/Client.pm	(revision 24996)
@@ -297,5 +297,5 @@
         my $instances = $stats[6];
         if (defined $instances and $instances < 2) {
-            $log->debug("can not cull - not enough instances");
+            $self->set_err("can not cull - not enough instances");
             $log->debug("leaving");
 
@@ -305,5 +305,5 @@
         $locations = $self->find_instances($key, $vol_name);
         unless (defined $locations) {
-            $log->debug( "no instances" );
+            $self->set_err( "no instances" );
             $log->debug( "leaving" );
 
@@ -313,5 +313,5 @@
         $locations = $self->find_instances($key);
         unless ($locations) {
-            $log->debug("no instances");
+            $self->set_err( "no instances" );
             $log->debug("leaving");
 
@@ -320,5 +320,5 @@
 
         if (scalar @{ $locations } < 2) {
-            $log->debug("can not cull - not enough instances");
+            $self->set_err("can not cull - not enough instances");
             $log->debug("leaving");
 
@@ -365,6 +365,5 @@
         if (not defined $self->prune($key)) {
             # use the prune() method to also determine if $key is valid
-            $removed = undef;
-            return;
+            die "invalid key: $key";
         }
 
@@ -377,4 +376,7 @@
         if (defined $locations) {
             my $instances = $self->find_instances($key);
+            if (scalar @$instances < 2) {
+                die "not enough instances";
+            }
             foreach my $victim (@$instances) {
                 next if $victim eq $locations->[0];
@@ -387,4 +389,7 @@
             # start at one so cull() is called one less time then the # of
             # instances
+            if ($stats->[6] < 2) {
+                die "not enough instances";
+            }
             for (my $i = 1; $i < $stats->[6]; $i++) {
                 $self->cull($key);
@@ -395,4 +400,8 @@
     };
     if ($@) {
+        if ($@ =~ qr/invalid key/) {
+            $self->set_err($@);
+            return;
+        }
         $log->logdie($@);
     }
