Occ files:scan --all results in error Argument #6 ($oldSize)

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): Nextcloud 27.0.2
Operating system and version (eg, Ubuntu 20.04): Raspberry OS 11 (bullseye)
Apache or nginx version (eg, Apache 2.4.25): Apache2 2.4.56-1
PHP version (eg, 7.4): PHP 8.2

The issue you are facing:
Running occ files:scan --all results in error. It is expecting integer type but float value is being passed instead

Is this the first time you’ve seen this error? (Y/N): Yes since I upgraded to version 27

Steps to replicate it:

  1. occ files:scan --all

The output of your Nextcloud log in Admin > Logging:

Nothing appears in the Admin>Logging when running the command line "occ files:scan --all"

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

TypeError: OC\Files\Cache\Scanner::scanChildren(): Argument #6 ($oldSize) must be of type int, float given, called in nextcloud-27.0
.2/lib/private/Files/Cache/Scanner.php on line 347 and defined in nextcloud-27.0.2/lib/private/Files/Cache/Scanner.php:391
Stack trace:
#0 nextcloud-27.0.2/lib/private/Files/Cache/Scanner.php(347): OC\Files\Cache\Scanner->scanChildren()
#1 nextcloud-27.0.2/lib/private/Files/Utils/Scanner.php(269): OC\Files\Cache\Scanner->scan()
#2 nextcloud-27.0.2/apps/files/lib/Command/Scan.php(164): OC\Files\Utils\Scanner->scan()
#3 nextcloud-27.0.2/apps/files/lib/Command/Scan.php(219): OCA\Files\Command\Scan->scanFiles()
#4 nextcloud-27.0.2/3rdparty/symfony/console/Command/Command.php(298): OCA\Files\Command\Scan->execute()
#5 nextcloud-27.0.2/core/Command/Base.php(177): Symfony\Component\Console\Command\Command->run()
#6 nextcloud-27.0.2/3rdparty/symfony/console/Application.php(1040): OC\Core\Command\Base->run()
#7 nextcloud-27.0.2/3rdparty/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#8 nextcloud-27.0.2/3rdparty/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#9 nextcloud-27.0.2/lib/private/Console/Application.php(211): Symfony\Component\Console\Application->run()
#10 nextcloud-27.0.2/console.php(100): OC\Console\Application->run()
#11 nextcloud-27.0.2/occ(11): require_once('...')

The output of your Apache/nginx/system log in /var/log/____:

Nothing appears in Apache log when running this command from command line or cron job

Nothing in the logs


Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

Nothing in logs

I don’t have a “do this and it’s over” solution, but have you already triggered it with the verbose flag?

occ files:scan -vvv --all

That always helped me because one can then see exactly at which file it derailes. Most of the time those were somehow problematic files that I could then repair from a backup or simply remove completely.
Of course I hope that you can solve your problem with this. It’s worth a try. At least you will gain deeper insight into the cause.

much luck!

Thank you for your quick reply.

I’ve tried your suggestion with more verbose but it doesn’t show me which file is causing this. If it gave me the value of the $oldSize and filename I would then try to fix it.
I’ve tried to scan my own user files and it also produces the same error.

I’ve created a new user and performed the same scan on that user which has no files then it runs to completion without errors. Any user with files will produce the error.

I had to upgrade to PHP 8.2 in order to upgrade my Nextcloud version to 27. Previously running version 26 and PHP 8.0 did not have this error.

Could it be PHP 8.2 that is the problem?