Skip to content

file being treated as directory after rename (Error 20 ENOTDIR) #10071

@lennart-goetz

Description

@lennart-goetz

⚠️ Before submitting, please verify the following: ⚠️

Bug description

When a file is renamed (e.g., from .PNG to .jpg), the client should detect the
rename and sync the metadata/file accordingly without interrupting the
discovery process. The discovery phase correctly detects a rename but subsequently attempts to
open the resulting file as if it were a directory (OCC::ProcessDirectoryJob).
This leads to a sync hang with the error Error while opening directory [...]
20 (ENOTDIR). The client remains stuck in "Checking for changes" indefinitely.

Additional Context
This issue seems to be triggered specifically when changing file extensions
during a rename or when files contain specific metadata (Alternate Data
Streams or similar) that might confuse the discovery algorithm. Moving the
file out of the sync folder, renaming it, and moving it back fixes the state,
but a direct rename triggers the bug.

Steps to reproduce

  1. Provide a file (in my case, a screenshot from a Rohde & Schwarz
    measurement device).
  2. Rename the file and change the extension (e.g., image.PNG -> image.jpg).
  3. The client enters the "Checking for changes" state and stays there.

Expected behavior

When a file is renamed (e.g., from .PNG to .jpg), the client should detect the
rename and sync the metadata/file accordingly without interrupting the
discovery process.

Which files are affected by this bug

first_S21.jpg

Operating system

Linux

Which version of the operating system you are running.

mint 22.3

Installation method

Official Linux AppImage

Nextcloud Server version

32.0.9

Nextcloud Desktop Client version

33.0.5

Did this occur after an update or on a clean installation?

Clean desktop client installation

Are you using the Nextcloud Server Encryption module?

Yes

Are you using an external user-backend?

  • Default internal user-backend
  • LDAP or Active Directory
  • SSO - SAML
  • Other

Nextcloud Server logs

Additional info

Evidence for Nextcloud Desktop Discovery Bug (ENOTDIR/Error 20)

Date: 2026-05-20
File: first_S21.jpg (Rename from .PNG)

The following log snippet shows the sequence where a file rename triggers an erroneous DirectoryJob, leading to a sync hang.

2026-05-20 14:31:26:576 [ info nextcloud.sync.discovery ]: Rename detected (up) "Studium/fachlich/Bachelorarbeit/screenshots/lna_v2/ZNL_ScreenShot_2026-05-20_08-10-55.PNG" -> "Studium/fachlich/Bachelorarbeit/screenshots/lna_v2/first_S21.jpg"
2026-05-20 14:31:26:583 [ info nextcloud.sync.discovery ]: STARTING "Studium/fachlich/Bachelorarbeit/screenshots/lna_v2/ZNL_ScreenShot_2026-05-20_08-10-55.PNG" OCC::ProcessDirectoryJob::ParentNotChanged "Studium/fachlich/Bachelorarbeit/screenshots/lna_v2/first_S21.jpg" OCC::ProcessDirectoryJob::NormalQuery
2026-05-20 14:31:26:583 [ info nextcloud.sync.discovery ]: Error while opening directory "/home/lennart/Nextcloud/Studium/fachlich/Bachelorarbeit/screenshots/lna_v2/first_S21.jpg" 20

Note: Error 20 is ENOTDIR. The client incorrectly treats the file 'first_S21.jpg' as a directory during the discovery phase after a rename.

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions