diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php
index 4893be25b2089be7fe53c2581b27aebb91e3895d..68729db6de85e1f8f297d900a1db0041a96c026b 100644
--- a/apps/files_sharing/lib/Controller/ShareAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareAPIController.php
@@ -768,6 +768,16 @@ class ShareAPIController extends OCSController {
 		$known = $formatted = $miniFormatted = [];
 		$resharingRight = false;
 		foreach ($shares as $share) {
+			try {
+				$share->getNode();
+			} catch (NotFoundException $e) {
+				/*
+				 * Ignore shares where we can't get the node
+				 * For example delted shares
+				 */
+				continue;
+			}
+
 			if (in_array($share->getId(), $known) || $share->getSharedWith() === $this->currentUser) {
 				continue;
 			}