Fix file delete, moved and copy

Nextcloud version (eg, 20.0.5): 27.0.0 RC1
Operating system and version (eg, Ubuntu 20.04): Ubuntu 22.04
Apache or nginx version (eg, Apache 2.4.25): apache2 latest version
PHP version (eg, 7.4): 8.2

The problem I have is that I can create folders, but what is to delete, move or copy does not let me

This happens since I pass the database to another vps, but the data is the same, only the ip changes of course, how can I solve it

In the logs I have this error although I don’t know how to fix it

TypeError: OC\Files\Cache\QuerySearchHelper::getCachesAndMountPointsForSearch(): Argument #1 ($root) must be of type OC\Files\Node\Root, OC\Files\Node\LazyRoot given, called in /var/www/ nubep2p/lib/private/Files/Node/Folder.php on line 238



There is a much lengthier stack trace associated with that log entry. You’ll have to post it.

You’ll also need to share your redacted config.php.

Did you upgrade to NC V27rc1 prior to the VPS move or after moving?

How did to migrate, specifically, the data? You may need to chown existing files/folders you migrated. Creating files may be working because the parent directory (likely data) ownership/permissions may be correct on your new VPS, but your existing files may have incorrect ownership/permissions due to the transfer.

I don’t know the cloud or the vps files, the only thing that was touched as I said was the database that I changed to another vps and since then I have had this problem

I have about same problem after upgrading, is an old installation. Tried chown already. Happens while trying to delete a folder.

$CONFIG = array (
  'instanceid' => '',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' =>
  array (
    0 => '',
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => '',
  'htaccess.RewriteBase' => '/',
  'dbname' => 'nextcloud',
  'dbhost' => '',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '',
  'default_phone_region' => '3166-2:ES',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  '' => 'stable',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_smtphost' => '',
  'mail_from_address' => '',
  'mail_domain' => '',
  'mail_smtpport' => '465',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtpname' => '',
  'mail_smtppassword' => '',
  'mail_smtpsecure' => 'ssl',
  'updater.secret' => '',
[webdav] Error: TypeError: OC\Files\Cache\QuerySearchHelper::getCachesAndMountPointsForSearch(): Argument #1 ($root) must be of type OC\Files\Node\Root, OC\Files\Node\LazyRoot given, called in /var/www/nextcloud/lib/private/Files/Node/Folder.php on line 237 at <<closure>>

 0. /var/www/nextcloud/lib/private/Files/Node/Folder.php line 237
 1. /var/www/nextcloud/lib/private/Files/Node/Folder.php line 291
 2. /var/www/nextcloud/apps/music/lib/Utility/Scanner.php line 383
 3. /var/www/nextcloud/apps/music/lib/Hooks/FileHooks.php line 42
 4. <<closure>>
 5. /var/www/nextcloud/lib/private/Hooks/EmitterTrait.php line 105
 6. /var/www/nextcloud/lib/private/Hooks/PublicEmitter.php line 40
 7. /var/www/nextcloud/lib/private/Files/Node/Root.php line 143
 8. <<closure>>
 9. /var/www/nextcloud/lib/private/Files/Node/LazyFolder.php line 72
10. /var/www/nextcloud/lib/private/Files/Node/LazyFolder.php line 100
11. /var/www/nextcloud/lib/private/Files/Node/HookConnector.php line 145
12. /var/www/nextcloud/lib/private/legacy/OC_Hook.php line 105
13. /var/www/nextcloud/lib/private/Files/View.php line 1295
14. /var/www/nextcloud/lib/private/Files/View.php line 1165
15. /var/www/nextcloud/lib/private/Files/View.php line 351
16. /var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php line 307
17. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php line 179
18. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 281
19. /var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
20. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 472
21. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 253
22. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 321
23. /var/www/nextcloud/apps/dav/lib/Server.php line 366
24. /var/www/nextcloud/apps/dav/appinfo/v2/remote.php line 35
25. /var/www/nextcloud/remote.php line 172
    require_once("/var/www/nextcl ... p")

DELETE /remote.php/dav/files/giou/Obsidiane
from IP by giou at 2023-05-26T21:05:08+00:00

Same problem here, after updating v26.

I found out that it was caused by an unsupported application that I had installed

I have a same issue, after updating to v26.0.2

What unsupported application

Is the Music app


I disabled the Music app, I can now delete folders here as well. I posted a similar issue recently.


Yes, aplication Music

1 Like

As I already commented on another thread:

Although this happens on the callback of the Music app, I believe that the root cause is a bug in Nextcloud.

As a quick-and-dirty monkey patch, you may modify the file lib/private/Files/Cache/QuerySearchHelper.php in your installation. Locate the line
public function getCachesAndMountPointsForSearch(Root $root, string $path, bool $limitToHome = false): array {
and modify it to be
public function getCachesAndMountPointsForSearch($root, string $path, bool $limitToHome = false): array {
i.e. remove the type declaration Root.


Thank you very much. Your suggestion to edit the PHP file worked perfectly. The errors were driving me crazy and I knew it couldn’t be the music app on its own as the issue. Hopefully the Nextcloud developers fix this in the next release of version 26.

Same problem here with Nextcloud 26.0.2. Disabling the music app as described by @SergioMadrid135_S worked perfectly.

Yep, can confirm. Long-time NC user here (≈10y). I installed the Music app a few weeks ago. Recently, folder deletions started to fail. Disabled “Music” and all works again. Pfff, who would have guessed …

1 Like

Thanks for the helpful discussion and analysis here, folks. I’ve logged this as [Bug]: type declaration "Root $root" in method signature of `getCachesAndMountPointsForSearch` causes file move failure · Issue #38634 · nextcloud/server · GitHub.

Alright, that got closed as a dupe. Here’s the real issue: fix: expect interface, not a specific implementation by blizzz · Pull Request #38625 · nextcloud/server · GitHub

I’m curious why it got labeled with the milestone ”Nextcloud 28”, considering it’s a regression.

1 Like

Just another confirmation of the same problem and the same solution. I would like to use the Music app again so hopefully this will be fixed in the next point release.

I could edit lib/private/Files/Cache/QuerySearchHelper.php but its one of those situations where I really shouldn’t have to and I don’t want to make changes that could potentially store up issues in the future.


The bug is also included in nextcloud version 27.

The issue is actively being worked on.

1 Like