diff --git a/apps/files/lib/Command/TransferOwnership.php b/apps/files/lib/Command/TransferOwnership.php
index cd776aaa4ef12a471c5c9b7c3fda0344b8aacdd8..022db9992008a5e679b99c20dd79e089d8304015 100644
--- a/apps/files/lib/Command/TransferOwnership.php
+++ b/apps/files/lib/Command/TransferOwnership.php
@@ -96,12 +96,12 @@ class TransferOwnership extends Command {
 
 		if (!$sourceUserObject instanceof IUser) {
 			$output->writeln("<error>Unknown source user $this->sourceUser</error>");
-			return;
+			return 1;
 		}
 
 		if (!$destinationUserObject instanceof IUser) {
 			$output->writeln("<error>Unknown destination user $this->destinationUser</error>");
-			return;
+			return 1;
 		}
 
 		$this->sourceUser = $sourceUserObject->getUID();
@@ -110,7 +110,7 @@ class TransferOwnership extends Command {
 		// target user has to be ready
 		if (!\OC::$server->getEncryptionManager()->isReadyForUser($this->destinationUser)) {
 			$output->writeln("<error>The target user is not ready to accept files. The user has at least to be logged in once.</error>");
-			return;
+			return 2;
 		}
 
 		$date = date('c');