Exception durin scan: Remote share not found

I am hosting a Nextcloud instance running version 27.1.9. During the execution of the cronjob, the server briefly loses connection.
I have determined that the file scan could be a possible cause. When running the command sudo -u www-data php occ files:scan, I receive the following error message for certain users:
Exception during scan: Remote share not found
#0 [internal function]: OCA\Files_Sharing\External\Storage->checkStorageAvailability()
#1 /var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(533): call_user_func_array()
#2 [internal function]: OC\Files\Storage\Wrapper\Wrapper->__call()
#3 /var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(533): call_user_func_array()
#4 [internal function]: OC\Files\Storage\Wrapper\Wrapper->__call()
#5 /var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(533): call_user_func_array()
#6 /var/www/html/nextcloud/apps/files_sharing/lib/External/Scanner.php(66): OC\Files\Storage\Wrapper\Wrapper->__call()
#7 /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php(352): OCA\Files_Sharing\External\Scanner->scanFile()
#8 /var/www/html/nextcloud/apps/files_sharing/lib/External/Scanner.php(39): OC\Files\Cache\Scanner->scan()
#9 /var/www/html/nextcloud/lib/private/Files/Utils/Scanner.php(273): OCA\Files_Sharing\External\Scanner->scan()
#10 /var/www/html/nextcloud/apps/files/lib/Command/Scan.php(164): OC\Files\Utils\Scanner->scan()
#11 /var/www/html/nextcloud/apps/files/lib/Command/Scan.php(219): OCA\Files\Command\Scan->scanFiles()
#12 /var/www/html/nextcloud/3rdparty/symfony/console/Command/Command.php(298): OCA\Files\Command\Scan->execute()
#13 /var/www/html/nextcloud/core/Command/Base.php(177): Symfony\Component\Console\Command\Command->run()
#14 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(1040): OC\Core\Command\Base->run()
#15 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#16 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#17 /var/www/html/nextcloud/lib/private/Console/Application.php(218): Symfony\Component\Console\Application->run()
#18 /var/www/html/nextcloud/console.php(100): OC\Console\Application->run()
#19 /var/www/html/nextcloud/occ(11): require_once(‘…’)
#20 {main}
Unfortunately, I am unable to determine the cause of this error. Has anyone else encountered the same issue and have a solution to propose? The External Storage app was installed in the past but has been disabled for some time now.
I would greatly appreciate any assistance you can provide to resolve this issue. Please let me know if you require any additional information from me.
Thank you for your support.
Best regards,

Sarah

Nextcloud version (eg, 29.0.5): 27.1.9
Operating system and version (eg, Ubuntu 29.04): Ubuntu 24.04
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.58
PHP version (eg, 8.3): 8.1

Try running with the -vvv option to get more verbose output during process. It may give you the remote share involved. Also, from a quick look at the code, it appears the logic may remove the share just before generating this exception. So it’s possible successive re-runs will succeed (eventually), but take that with a grain of salt: I didn’t dig too deeply in the code underneath.

P.S. Enclose your stack trace as preformatted text by editing your original post if possible. Otherwise it’s difficult to read the trace.