Skip to content

[Bug]: occ share:list aborts with "Node for share not found" if any orphaned share exists #61949

Closed

Description

@Fantu

⚠️ This issue respects the following points: ⚠️

Bug description

occ share:list aborts with exit code 1 and produces no output at all as soon as a single orphaned share exists (a row still present in oc_share whose file id can no longer be resolved):

In Share.php line 169:
  Node for share not found, fileid: 275263

One orphaned share makes the whole command unusable, e.g. for scheduled exports of all shares.

Orphaned shares are easy to accumulate in practice: they are left behind when a shared file is deleted directly on the storage (external storage / SMB) and also when a shared file is moved to the trash bin (shares are not removed on trashbin deletion, and DeleteOrphanedSharesJob only cleans them up once the file id is gone from the file cache completely).

Steps to reproduce

  1. Share a file (e.g. a public link share)
  2. Delete the file bypassing Nextcloud (e.g. directly on the storage / via SMB), then run occ files:scan so the file cache entry is removed. The row in oc_share remains (orphaned share).
  3. Run occ share:list

Expected behavior

The command lists the shares it can resolve; orphaned shares are skipped or marked instead of aborting the whole command.

Nextcloud Server version

32

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database engine version

MariaDB

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

Probable cause: in apps/files_sharing/lib/Command/ListShares.php, execute() maps every share through $share->getNode()->getPath() without handling the NotFoundException thrown by Share::getNode() when the file id cannot be resolved. Still the case on current master. The command was introduced in Nextcloud 32 (#51399).

Activity

  1. added
    0. Needs triagePending check for reproducibility or if it fits our roadmap
    on Jul 9, 2026
  2. added theissue type on Jul 9, 2026
  3. added a commit that references this issue on Jul 13, 2026
    de91c32
  4. tzerber commented on Jul 14, 2026

    @tzerber

    I can confirm i had the same issue, had to manually clear the shares via the DB

  5. Fantu commented on Jul 14, 2026

    @Fantu
    ContributorAuthor

    I did the fix and is also easy and fast to backports manually, if someone needs it before will be merged and backported: #62060

  6. added a commit that references this issue on Sep 9, 2026
    a05147b
  7. added a commit that references this issue on Sep 9, 2026
    52dbfb7
  8. added 2 commits that reference this issue on Sep 15, 2026
    09dd622
    b6ca3b4
  9. github-actions commented on Oct 31, 2026

    @github-actions
    Contributor

    This issue has been automatically locked because it has been closed for more than 14 days. As we do not monitor closed issues, we are locking this issue to prevent further comments from getting lost in the noise.
    Please open a new issue if you have a similar problem instead. For general discussions, please use our forum: https://help.nextcloud.com

  10. locked as resolved and limited conversation to collaborators on Oct 31, 2026
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 roadmap32-feedbackbug

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions