Skip to content

[Bug]: 500 Internal Server Error when assigning system tag to Group Folder: OCP\Files\NotFoundException in Activity Listener ShareHelper #65720

Open

Description

@mdmiko

⚠️ 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

When assigning a collaborative system tag to a file or folder inside a Group Folder, Nextcloud responds with an HTTP 500 Internal Server Error, and the UI displays the error toast "Failed to apply tags changes".

Despite the error, the tag mapping is successfully written to the database. If the user clicks "Apply" a second time (or refreshes the page), the tag is already present and the request completes successfully with HTTP 207 Multi-Status.

The root cause is in OCA\SystemTags\Activity\Listener: upon tag assignment, it calls OCA\Share20\ShareHelper::getPathsForAccessList() to resolve folder paths for all group members. If any user in the group has an uninitialized, stale, or unmounted path for that Group Folder (e.g. an inactive user), an unhandled OCP\Files\NotFoundException is thrown, aborting the WebDAV request with a 500 status.

Steps to reproduce

Configure a Group Folder (via groupfolders) accessible by a user group. Ensure at least one member of that group has not yet accessed or initialized their personal mount path for the folder.

Log into Nextcloud with an account that has write permissions on the Group Folder.

Open the details panel for any file or subfolder inside the Group Folder and go to the Tags section.

Select and assign a collaborative tag, then submit/apply.

Notice the HTTP 500 error and the UI toast: "Failed to apply tags changes".

Click "Apply" again or reload the page: the tag is applied and subsequent requests return HTTP 207.

Expected behavior

The system tag should be applied cleanly on the first attempt, returning HTTP 200/207 without throwing an HTTP 500 or showing an error toast, even if some users in the group access list do not have active or initialized folder mounts.

Nextcloud Server version

34

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.3

Web server

Apache (supported)

Database engine version

None

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

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

List of activated Apps

Nextcloud Signing status

Nextcloud Logs

Additional info

Activity

  1. added
    0. Needs triagePending check for reproducibility or if it fits our roadmap
    on Oct 20, 2026
  2. added theissue type on Oct 20, 2026
  3. mdmiko commented on Oct 20, 2026

    @mdmiko
    Author

    Proposed fix

    In apps/systemtags/lib/Activity/Listener.php, the listener resolves the file/folder paths for all accounts returned in the access list of the object. When a member of a Group Folder hasn't initialized their personal mount point or if an account has a stale mount path, ShareHelper::getPathsForAccessList() invokes getParent() on a non-existent node, throwing OCP\Files\NotFoundException.

    Because this exception is unhandled within the activity listener, it terminates the entire WebDAV request with an HTTP 500 error, even though the tag mapping was already persisted in the database.

    Wrapping the path resolution loop or the call to getPathsForAccessList() inside a try / catch (\OCP\Files\NotFoundException $e) block allows Nextcloud to skip the unresolvable user path and complete the tag assignment cleanly with HTTP 207/200.

    Code diff

    --- a/apps/systemtags/lib/Activity/Listener.php
    +++ b/apps/systemtags/lib/Activity/Listener.php
    @@ -140,7 +140,11 @@ class Listener {
     		$node = $event->getNode();
     
     		try {
    -			$paths = $this->shareHelper->getPathsForAccessList($node);
    +			try {
    +				$paths = $this->shareHelper->getPathsForAccessList($node);
    +			} catch (\OCP\Files\NotFoundException $e) {
    +				$paths = [];
    +			}
     		} catch (\Exception $e) {
     			$this->logger->warning('Could not get paths for access list: ' . $e->getMessage(), ['app' => 'systemtags']);
     			return;
    Alternatively, if handling it inside getPathsForAccessList() in lib/private/Share20/ShareHelper.php:
    
    Diff
    --- a/lib/private/Share20/ShareHelper.php
    +++ b/lib/private/Share20/ShareHelper.php
    @@ -40,6 +40,8 @@ class ShareHelper {
     			foreach ($accessList['users'] as$user) {
     				try {
     					$userFolder = $this->rootFolder->getUserFolder($user);
     					// resolve path ...
    +				} catch (\OCP\Files\NotFoundException $e) {
    +					continue;
     				}
     			}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmap34-feedbackbug

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions