nextcloud / nextcloud/server

[Bug]: occ files:scan --all exception: Argument #1 ($parent) must be of type int

Open
#63,676 0 comments 0 reactions 1 assignee View on GitHub

@CarlSchwan is already working on this.

Since Aug 31, 2026.

0. Needs triage 34-feedback bug
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

⚠️ This issue respects the following points: ⚠️
  • This is not a troubleshooting question, general support matter, or webserver/proxy problem, but likely a bug (if unsure, ask the Community Help Forum).
  • This issue is not already reported on Github OR solved at the Community Help Forum (I've searched!).
  • I'm using a maintained major version of Nextcloud Server and tested against the latest patch level. (Supported major versions and current patch levels).
  • I agree to follow Nextcloud's Code of Conduct.
  • I've tried my best to provide clear reproduction steps that someone unfamiliar with this bug could use to reproduce it.
Bug description

If I run php occ files:scan --all I get an exception:

$ php occ files:scan --all
Starting scan for user 1 out of 6 (a)
Starting scan for user 2 out of 6 (m)
Starting scan for user 3 out of 6 (o)
Starting scan for user 4 out of 6 (r)
Starting scan for user 5 out of 6 (s)
An unhandled exception has been thrown:
TypeError: OC\Files\Cache\CacheQueryBuilder::whereParent(): Argument #1 ($parent) must be of type int, null given, called in /var/www/virtual/h/cloud.example.com/lib/private/Files/Cache/Cache.php on line 1049 and defined in /var/www/virtual/h/cloud.example.com/lib/private/Files/Cache/CacheQueryBuilder.php:89
Steps to reproduce
  1. Run the command php occ files:scan --all in the nextcloud web root directory
Expected behavior

No exception

Nextcloud Server version

34

Operating system

RHEL/CentOS

PHP engine version

PHP 8.5

Web server

Nginx

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

No response

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?
  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other
Configuration report
$ php occ config:list system
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "cloud.example.com",
            "owncloud.example.com"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "https:\/\/cloud.example.com",
        "dbtype": "mysql",
        "version": "34.0.2.1",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "default_phone_region": "DE",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "maintenance": true,
        "theme": "",
        "loglevel": 0,
        "mail_smtpmode": "sendmail",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpauth": 1,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "mail_sendmailmode": "pipe",
        "mail_smtpauthtype": "PLAIN",
        "trashbin_retention_obligation": "auto, 30",
        "updater.release.channel": "stable",
        "twofactor_enforced": "true",
        "twofactor_enforced_groups": [
            "admin"
        ],
        "preview_max_x": 512,
        "preview_max_y": 512,
        "preview_max_scale_factor": 2,
        "twofactor_enforced_excluded_groups": [],
        "htaccess.RewriteBase": "\/",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": "0",
            "timeout": "1.5"
        },
        "filelocking.enabled": "true",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "maintenance_window_start": 4,
        "app_install_overwrite": [
            "circlesdb",
            "unsplash"
        ],
        "simpleSignUpLink.shown": false,
        "serverid": "146",
        "updater.secret": "***REMOVED SENSITIVE VALUE***"
    }
}
List of activated Apps
$ php occ app:list
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Enabled:
  - activity: 7.0.0
  - admin_audit: 1.24.0
  - appointments: 2.7.4
  - appstore: 1.0.0
  - autocurrency: 1.8.3
  - bruteforcesettings: 7.0.0
  - calendar: 6.5.2
  - calendar_resource_management: 0.12.1
  - circles: 34.0.0
  - cloud_federation_api: 1.18.0
  - collectives: 4.4.2
  - comments: 1.24.0
  - contacts: 8.7.5
  - contactsinteraction: 1.15.0
  - cospend: 4.0.2
  - dashboard: 7.14.0
  - dav: 1.39.0
  - deck: 1.18.3
  - federatedfilesharing: 1.24.0
  - federation: 1.24.0
  - files: 2.6.0
  - files_downloadlimit: 5.2.0
  - files_external: 1.26.0
  - files_lock: 34.0.1
  - files_pdfviewer: 7.0.0-dev.0
  - files_reminders: 1.7.0
  - files_sharing: 1.26.0
  - files_trashbin: 1.24.0
  - files_versions: 1.27.0
  - firstrunwizard: 7.0.0-dev.0
  - gpoddersync: 3.17.0
  - groupfolders: 22.0.5
  - logreader: 7.0.0
  - lookup_server_connector: 1.22.0
  - nextcloud_announcements: 6.0.0
  - notes: 6.0.1
  - notifications: 7.0.0-dev.1
  - notify_push: 1.3.5
  - oauth2: 1.22.0
  - office: 1.0.0
  - password_policy: 6.0.0-dev.0
  - phonetrack: 1.3.1
  - photos: 7.0.0
  - privacy: 6.0.0-dev.1
  - profile: 1.3.0
  - provisioning_api: 1.24.0
  - quota_warning: 1.24.0
  - recommendations: 7.0.0
  - related_resources: 5.0.0-dev.0
  - serverinfo: 6.0.0
  - settings: 1.17.0
  - sharebymail: 1.24.0
  - support: 6.0.0
  - survey_client: 6.0.0-dev.0
  - systemtags: 1.24.0
  - tasks: 0.18.1
  - text: 8.0.0
  - theming: 2.9.0
  - twofactor_backupcodes: 1.23.0
  - twofactor_nextcloud_notification: 8.0.0
  - twofactor_totp: 16.0.0
  - updatenotification: 1.24.0
  - user_status: 1.14.0
  - viewer: 7.0.0-dev.0
  - weather_status: 1.14.0
  - webhook_listeners: 1.6.0
  - workflowengine: 2.16.0
Disabled:
  - app_api: 34.0.0 (installed 32.0.0)
  - encryption: 2.22.0
  - files_rightclick: 0.15.1 (installed 1.6.0)
  - holiday_calendars: 0.3.0 (installed 0.3.0)
  - suspicious_login: 12.0.0-dev.0
  - testing: 1.23.0
  - unsplash: 3.1.0 (installed 3.1.0)
  - user_ldap: 1.25.0
  - user_usage_report: 4.0.0 (installed 4.0.0)
Nextcloud Signing status
No errors have been found.
Nextcloud Logs

Additional info

Stacktrace:

#0 /var/www/virtual/h/cloud.example.com/lib/private/Files/Cache/Cache.php(1049): OC\Files\Cache\CacheQueryBuilder->whereParent(NULL)
#1 /var/www/virtual/h/cloud.example.com/lib/private/Files/Cache/Cache.php(1025): OC\Files\Cache\Cache->calculateFolderSizeInner('', Object(OC\Files\Cache\CacheEntry))
#2 /var/www/virtual/h/cloud.example.com/lib/private/Files/Cache/Cache.php(971): OC\Files\Cache\Cache->calculateFolderSize('', NULL)
#3 /var/www/virtual/h/cloud.example.com/lib/private/Files/Utils/Scanner.php(236): OC\Files\Cache\Cache->correctFolderSize('')
#4 /var/www/virtual/h/cloud.example.com/apps/files/lib/Command/Scan.php(169): OC\Files\Utils\Scanner->scan('/stefan', true, Object(Closure))
#5 /var/www/virtual/h/cloud.example.com/apps/files/lib/Command/Scan.php(260): OCA\Files\Command\Scan->scanFiles('stefan', '/stefan', NULL, Object(Symfony\Component\Console\Output\ConsoleOutput), Object(Closure), false, true)
#6 /var/www/virtual/h/cloud.example.com/3rdparty/symfony/console/Command/Command.php(326): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /var/www/virtual/h/cloud.example.com/core/Command/Base.php(222): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /var/www/virtual/h/cloud.example.com/3rdparty/symfony/console/Application.php(1098): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /var/www/virtual/h/cloud.example.com/3rdparty/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /var/www/virtual/h/cloud.example.com/3rdparty/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /var/www/virtual/h/cloud.example.com/lib/private/Console/Application.php(209): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /var/www/virtual/h/cloud.example.com/console.php(92): OC\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput))
#13 /var/www/virtual/h/cloud.example.com/occ(33): require_once('/var/www/virtua...')
#14 {main}

I updated to 34.0.3 - still the same exception

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.