NC - corrupted directory tree

Nextcloud version (eg, 20.0.5): 27.1.2
Operating system and version (eg, Ubuntu 20.04): Linux
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.57
PHP version (eg, 7.4): 8.1.18

Reported as a bug on Github:

The issue you are facing:

At first I want to mention that I’m using Nextcloud for years now without having major issues with my configuration and installation. It might be worth to know, that I’m using external storage, mounted via WebDAV to store my files.

End of September I decided to upgrade my server from Nextcloud 26.0.7 to 27.1.1. The installation itself worked without any issue and but after a while I noticed that the Notes app caused errors because it couldn’t handle sub folders correctly anymore. Due to the fact that I’m not using this app very often I decided to delete all sub folder below the Notes directory to get rid of the errors and wanted to wait for a new Notes app release.

This week I’ve upgrade the server to Nextcloud 27.1.2 and again everything looked fine and I was able to use all functions as before. Today I wanted to lookup some files and navigated to a sub folder. Surprisingly all files and folders in that subdirectory were shown without the leading two characters of its names. It looks like something has currupted the directory tree somehow, but other directories with sub folders in it, which exist in parallel of this one, are still being displayed correctly.

I tried to rescan the subdirectory b< executing ./occ files:scan <user> -p /<user>/files/folder but the command shows invalid file names too.

I’ve also tried to access Nextcloud using a different web browser or the Nextcloud app, but all are showing the corrupted files and directory names.

These are the names of the files and directories as they are shown in the web gui:


These are the names of the files and directories as they exist on the hard disk:

eCards → CueCards
gene Musik → Eigene Musik
ergen → Juergen

Is this the first time you’ve seen this error? (Y/N): Yes

Steps to replicate it:

  1. Open the Files app in a web browser
  2. Open a sub folder, e.g. Dateien, which points to an external mount
  3. Check the files which are being displayed.

FYI, the sub folders name below "Dateien" is "CueCards" but as it can be seen from the log file, "/Dateien/eCards" are found and displayed.

The output of your Nextcloud log in Admin > Logging:

... ,"user":"juergen","app":"webdav","method":"PROPFIND","url":"/remote.php/dav/files/juergen/Dateien/eCards","message":"Sabre\\HTTP\\ClientHttpException: Not Found","userAgent":"Mozilla/5.0 (Windows) mirall/3.10.0stable-Win64 (build 20230915) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"","exception":{"Exception":"Sabre\\DAV\\Exception\\ServiceUnavailable","Message":"Sabre\\HTTP\\ClientHttpException: Not Found","Code":0,"Trace":[{"file":"/srv/www/nextcloud/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":78,"function":"getChild","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->","args":["eCards"]},{"file":"/srv/www/nextcloud/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":971,"function":"getNodeForPath","class":"Sabre\\DAV\\Tree","type":"->","args":["files/juergen/Dateien/eCards"]},{"file":"/srv/www/nextcloud/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":1662,"function":"getPropertiesIteratorForPath","class":"Sabre\\DAV\\Server","type":"->","args":["files/juergen/Dateien/eCards",["{DAV:}resourcetype","{DAV:}getlastmodified","{DAV:}getcontentlength","{DAV:}getetag","{}size","And 7 more entries, set log level to debug to see all entries"],1]},{"file":"/srv/www/nextcloud/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":1647,"function":"writeMultiStatus","class":"Sabre\\DAV\\Server","type":"->","args":[["Sabre\\Xml\\Writer",[],"/remote.php/dav/",["d","s","oc","nc"],[]],["Generator"],false]},{"file":"/srv/www/nextcloud/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":346,"function":"generateMultiStatus","class":"Sabre\\DAV\\Server","type":"->","args":[["Generator"],false]},{"file":"/srv/www/nextcloud/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpPropFind","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[["Sabre\\HTTP\\Request"],["Sabre\\HTTP\\Response"]]},{"file":"/srv/www/nextcloud/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->","args":["method:PROPFIND",[["Sabre\\HTTP\\Request"],["Sabre\\HTTP\\Response"]]]},{"file":"/srv/www/nextcloud/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[["Sabre\\HTTP\\Request"],["Sabre\\HTTP\\Response"]]},

Related log line in Apache access log

... "PROPFIND /remote.php/dav/files/juergen/Dateien/eCards HTTP/1.1" 404 243 "-" "Mozilla/5.0 (Windows) mirall/3.10.0stable-Win64 (build 20230915) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)" 1260 1142

Any ideas how this issue can be resolved are hightly appreciated.

I’ve just scanned the directories of an other user using occ files:scan and have seen the same issue. The first two characters of files in a sub directory are not shown anymore although they exist on the hard disk. It seems as if a general issue with the files scanning exists?!

From your post and the bug report I have the impression that Nextcloud (and the clients) still expects the old file names. So if it had been changed through Nextcloud, it would already take the new names.

Can you check when these files were changed (stat filename)? Then you can cross-check on the Nextcloud/webserver logfiles, if that change was induced by Nextcloud itself, or with the date if it might be the update. In theory, the update does not touch the data itself (just the code).

Other thing, from within Nextcloud, workflows could perhaps modify filenames and something might have gone wrong.

Is this normal disk space on Linux, or network shares?


A file and directory name change has never been actively initiated . The files on the hard drive/share still exists with the original names, only the directory tree contains new names where the first two characters have been cut off the names.

Can you check when these files were changed (stat filename)?

The files and directories haven’t been changed on the hard disk:

 # stat CueCards
  File: CueCards
  Size: 4096            Blocks: 8          IO Block: 4096   directory
Device: 0,39    Inode: 4998849     Links: 3
Access: (0700/drwx------)  Uid: ( 2000/ juergen)   Gid: (  100/   users)
Access: 2023-10-09 22:01:39.551711578 +0200
Modify: 2015-12-11 13:31:12.260000001 +0100
Change: 2017-11-20 20:43:07.657264250 +0100

# stat Eigene\ Musik
  File: Eigene Musik
  Size: 4096            Blocks: 8          IO Block: 4096   directory
Device: 0,39    Inode: 5006527     Links: 2
Access: (0700/drwx------)  Uid: ( 2000/ juergen)   Gid: (  100/   users)
Access: 2023-10-10 09:03:01.196505760 +0200
Modify: 2013-02-18 17:12:33.000000000 +0100
Change: 2017-11-20 20:43:07.837260192 +0100
 Birth: -

# stat Juergen_... .pdf
  File: Juergen_... .pdf
  Size: 42496           Blocks: 88         IO Block: 131072 regular file
Device: 0,39    Inode: 5020846     Links: 1
Access: (0666/-rw-rw-rw-)  Uid: ( 2000/ juergen)   Gid: (  100/   users)
Access: 2023-05-15 14:43:47.145147579 +0200
Modify: 2020-08-31 13:48:47.500561656 +0200
Change: 2020-08-31 13:48:47.550560527 +0200
 Birth: -

Other thing, from within Nextcloud, workflows could perhaps modify filenames and something might have gone wrong.

I don’t believe that a workflow could be responsible for it because it also happens if "occ files:scan" command is executed, which usually scans the directory tree and updates the database accordingly.
Due to that it seems that the correct files and directory names are found but somehow two characters at the beginning got removed when building the full path name based on the mounted WebDAV path and the file name itself. Haven’t we had a similar issue years ago?

In the meantime a duplicate ticket has been identified which covers the same topic:

I wonder if no-one else ran into that problem except @DSG5TRDD and me?

The initial issue has been reported more than 2 month ago and it seems that the issue hasn’t yet been prioritized by the team yet. The Nextcloud file function became more or less unusable for me, because files are not accessible anymore, although they exist on the server. Nextcloud doesn’t support a fallback to a previous major version so that I’m currently struggeling what the best wait to go would be.

Unfortunately it’s just an old backup that you ideally have done just before the upgrade.

If it is possible to reproduce the problem with federated sharing, it would be more urgent since it is a NC feature and no 3rd-party is involved. They put it on the list for the Files team’s tasks. The next point release is scheduled next week, with no activity right now, I wouldn’t count on a fix there and for the next release, it would be another month.