Ncp-scan error: There are no commands defined in the "files" namespace


I have a quite young nextcloud running at home on a Pi 4.

I started not to move some data there. To speed this up (and to avoid strange errors when using the nextcloud desktop client), I copied the files directly to the USB HDD.
Then, I ran “ncp’s fix permissions” and then “ncp-scan”.

With the first set up files this worked fine.

Now, I copied the next couple of GBs, and when I run ncp-scan, I get this error message:

pi@nextcloudpi:~ $ sudo ncp-scan 
Nextcloud is in maintenance mode - no apps have been loaded

In Application.php line 583:
  There are no commands defined in the "files" namespace.           

Exception trace:
  at /var/www/nextcloud/3rdparty/symfony/console/Application.php:583
 Symfony\Component\Console\Application->findNamespace() at /var/www/nextcloud/3rdparty/symfony/console/Application.php:632
 Symfony\Component\Console\Application->find() at /var/www/nextcloud/3rdparty/symfony/console/Application.php:236
 Symfony\Component\Console\Application->doRun() at /var/www/nextcloud/3rdparty/symfony/console/Application.php:148
 Symfony\Component\Console\Application->run() at /var/www/nextcloud/lib/private/Console/Application.php:214
 OC\Console\Application->run() at /var/www/nextcloud/console.php:99
 require_once() at /var/www/nextcloud/occ:11

I use:

NextCloudPi version v1.28.1

Nextcloud version

Any idea / suggestion?

Do the permissions and ownership of the new files match the existing files?

I now had the time to check: the permissions were different, I correct this and ran ncp-scan again, but got the same error.

What does this message mean: There are no commands defined in the "files" namespace.?
What is the “files” namespace?

I think that is in reference to occ which (I think) is being run on the backend when you run ncp-scan. On a normal installation you would run occ files:scan to do that.

I don’t know what would cause occ to be missing commands. Seems like it would be a fairly serious error.

I ran fix permissions again, and suddenly the error was gone … no idea what caused the problem.
Anyway, thanks for your help!

there is a easier way:
dont put your cloud under maintenance mode :wink:
You must do the scan under “live-environment”…i dont know why, but i tested it:
if my cloud was put in maintenance mode i get this error: There are no commands defined in the “files” namespace.

if i do the scan NOT under maintenance it scans all correctly.