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

imagen

3 Likes

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.

<?php
$CONFIG = array (
  'instanceid' => '',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' =>
  array (
    0 => 'cloud.org',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '26.0.2.1',
  'overwrite.cli.url' => 'https://cloud.org/',
  'htaccess.RewriteBase' => '/',
  'dbname' => 'nextcloud',
  'dbhost' => '127.0.0.1',
  '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,
  'updater.release.channel' => '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
    OC\Files\Cache\QuerySearchHelper->getCachesAndMountPointsForSearch()
 1. /var/www/nextcloud/lib/private/Files/Node/Folder.php line 291
    OC\Files\Node\Folder->search()
 2. /var/www/nextcloud/apps/music/lib/Utility/Scanner.php line 383
    OC\Files\Node\Folder->searchByMime()
 3. /var/www/nextcloud/apps/music/lib/Hooks/FileHooks.php line 42
    OCA\Music\Utility\Scanner->deleteFolder()
 4. <<closure>>
    OCA\Music\Hooks\FileHooks::deleted()
 5. /var/www/nextcloud/lib/private/Hooks/EmitterTrait.php line 105
    call_user_func_array()
 6. /var/www/nextcloud/lib/private/Hooks/PublicEmitter.php line 40
    OC\Hooks\BasicEmitter->emit()
 7. /var/www/nextcloud/lib/private/Files/Node/Root.php line 143
    OC\Hooks\PublicEmitter->emit()
 8. <<closure>>
    OC\Files\Node\Root->emit()
 9. /var/www/nextcloud/lib/private/Files/Node/LazyFolder.php line 72
    call_user_func_array()
10. /var/www/nextcloud/lib/private/Files/Node/LazyFolder.php line 100
    OC\Files\Node\LazyFolder->__call()
11. /var/www/nextcloud/lib/private/Files/Node/HookConnector.php line 145
    OC\Files\Node\LazyFolder->emit()
12. /var/www/nextcloud/lib/private/legacy/OC_Hook.php line 105
    OC\Files\Node\HookConnector->delete()
13. /var/www/nextcloud/lib/private/Files/View.php line 1295
    OC_Hook::emit()
14. /var/www/nextcloud/lib/private/Files/View.php line 1165
    OC\Files\View->runHooks()
15. /var/www/nextcloud/lib/private/Files/View.php line 351
    OC\Files\View->basicOperation()
16. /var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php line 307
    OC\Files\View->rmdir()
17. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php line 179
    OCA\DAV\Connector\Sabre\Directory->delete()
18. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 281
    Sabre\DAV\Tree->delete()
19. /var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
    Sabre\DAV\CorePlugin->httpDelete()
20. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 472
    Sabre\DAV\Server->emit()
21. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 253
    Sabre\DAV\Server->invokeMethod()
22. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 321
    Sabre\DAV\Server->start()
23. /var/www/nextcloud/apps/dav/lib/Server.php line 366
    Sabre\DAV\Server->exec()
24. /var/www/nextcloud/apps/dav/appinfo/v2/remote.php line 35
    OCA\DAV\Server->exec()
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

1 Like

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

1 Like

Yes, aplication Music

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.

2 Likes

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.