Windows 10 Desktop Client: Directories are marked as files - Sync creates error 'Access is denied'

Nextcloud version : 20.0.4 (latest)
Operating system : Raspberry Pi OS (latest)

Nextcloud client : 3.1.1
Operating system : Windows 10

The issue you are facing:

I am trying to sync my files from my desktop (upload), but several folders are marked with ‘Access denied’. The log shows that these folders are marked as files in the beginning of the sync progress. Folders with comparable size or files in it are synced or not synced. Permissions have been checked but do not show any difference at all.
Sync connection was readded several times without any differences. Update from Nextcloud 20.0.3 and Nextcloud Client 3.1.0 did not resolve this error.
I was able to reproduce this error with several different folders in my filesystem. I don’t think the error is on server side so I mainly attach details to client connection.

Is this the first time you’ve seen this error? : No

Steps to replicate it (on my computer):

  1. Add sync connection to a larger folder
  2. Wait for sync to check file differences
  3. Dekstop client starts to upload portions of the avaiable data and gives information ‘Access is denied’ for other folders.

Example:
Choosing a whole folder uploads part of the data. Tested for a folder containing music data. It tried to upload 16 of 96GB and marks the rest as ‘Access denied’. When I chose to sync a specific folder which is marked with the error it uploads it without any problem.

An example of an aquired error from the client log is appended.
I may append any complete client logs if I either can replicate this in a smaller scale (without so many personal information) or if anyone can specifiy what parts of the log are of interest.

Log when trying to upload folder with syncing
2020-12-27 15:11:44:481 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::bindValue ]:	SQL bind 1 QVariant(QString, "Julius Files/Musik/Interpreten/Amon Tobin")
2020-12-27 15:11:44:484 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::exec ]:	SQL exec "SELECT chunk, transferid, errorcount, size, modtime, contentChecksum FROM uploadinfo WHERE path=?1"
2020-12-27 15:11:44:486 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::bindValue ]:	SQL bind 1 QVariant(QByteArray, "Julius Files/Musik/Interpreten/Amon Tobin")
2020-12-27 15:11:44:489 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::exec ]:	SQL exec "SELECT baseFileId, baseModtime, baseEtag FROM conflicts WHERE path=?1;"
2020-12-27 15:11:44:491 [ debug nextcloud.sync.propagator.upload ]	[ OCC::PropagateUploadFileV1::startNextChunk ]:	0 true 0 0
2020-12-27 15:11:44:493 [ debug default ]	[ OCC::PropagateUploadFileV1::startNextChunk ]:	Trying to upload "D:/Nextcloud/Julius Files/Musik/Interpreten/Amon Tobin"
2020-12-27 15:11:44:495 [ warning nextcloud.sync.propagator.upload ]:	Could not prepare upload device:  "Access is denied."
2020-12-27 15:11:44:498 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::bindValue ]:	SQL bind 1 QVariant(QString, "Julius Files/Musik/Interpreten/Amon Tobin")
2020-12-27 15:11:44:500 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::exec ]:	SQL exec "SELECT lastTryEtag, lastTryModtime, retrycount, errorstring, lastTryTime, ignoreDuration, renameTarget, errorCategory FROM blacklist WHERE path=?1 COLLATE NOCASE"
2020-12-27 15:11:44:503 [ warning nextcloud.sync.propagator ]:	Could not complete propagation of "Julius Files/Musik/Interpreten/Amon Tobin" by OCC::PropagateUploadFileV1(0x2411fa61900) with status 3 and error: "Access is denied."
2020-12-27 15:11:44:505 [ debug nextcloud.sync.statustracker ]	[ OCC::SyncFileStatusTracker::slotItemCompleted ]:	Item completed "Julius Files/Musik/Interpreten/Amon Tobin" 3 8
2020-12-27 15:11:44:507 [ warning nextcloud.gui.activity ]:	Item  "Julius Files/Musik/Interpreten/Amon Tobin"  retrieved resulted in  "Access is denied."
2020-12-27 15:11:44:510 [ warning nextcloud.gui.activity ]:	Item  "Julius Files/Musik/Interpreten/Amon Tobin"  retrieved resulted in error  "Access is denied."
2020-12-27 15:11:44:512 [ info nextcloud.gui.activity ]:	Error successfully added to the notification list:  "Access is denied."

Further inspection of the complete log file showed, that the client tried to add folders as a file. Appended are all entries containing the specific folder from the log (‘Amon Tobin’). Some other folders are marked correctly and the files in it are processed and uploaded as usual, a log for that is appended as well.

Log of a failed directory
2020-12-27 15:57:14:874 [ debug nextcloud.sync.csync.updater ]	[ csync_walker ]:	file: Amon Tobin [inode=64008 size=0]
2020-12-27 15:57:14:874 [ info nextcloud.sync.csync.updater ]:	Checking for rename based on inode # 64008
2020-12-27 15:57:14:874 [ info nextcloud.sync.csync.updater ]:	file: Amon Tobin, instruction: INSTRUCTION_NEW <<=
...
2020-12-27 15:57:15:480 [ info nextcloud.sync.csync.reconciler ]:	INSTRUCTION_NEW                client file: Amon Tobin
...
2020-12-27 15:57:15:515 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::bindValue ]:	SQL bind 1 QVariant(QString, "Amon Tobin")
2020-12-27 15:57:15:515 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::exec ]:	SQL exec "SELECT lastTryEtag, lastTryModtime, retrycount, errorstring, lastTryTime, ignoreDuration, renameTarget, errorCategory FROM blacklist WHERE path=?1 COLLATE NOCASE"
...
2020-12-27 15:57:15:714 [ debug nextcloud.sync.statustracker ]	[ OCC::SyncFileStatusTracker::slotAboutToPropagate ]:	Investigating "Amon Tobin" 0 8
...
2020-12-27 15:57:24:450 [ info nextcloud.sync.propagator ]:	Starting INSTRUCTION_NEW propagation of "Amon Tobin" by OCC::PropagateUploadFileV1(0x1e0204b84f0)
2020-12-27 15:57:24:450 [ debug nextcloud.sync.propagator ]	[ OCC::OwncloudPropagator::scheduleNextJobImpl ]:	Can pump in another request! activeJobs = 5
Log of a successfully uploaded directory
2020-12-27 15:57:14:881 [ debug nextcloud.sync.csync.updater ]	[ csync_walker ]:	directory: Ariana Grande [inode=10636]
2020-12-27 15:57:14:881 [ info nextcloud.sync.csync.updater ]:	Checking for rename based on inode # 10636
2020-12-27 15:57:14:881 [ info nextcloud.sync.csync.updater ]:	file: Ariana Grande, instruction: INSTRUCTION_NEW <<=
...
2020-12-27 15:57:15:483 [ info nextcloud.sync.csync.reconciler ]:	INSTRUCTION_NEW                client dir:  Ariana Grande
...
2020-12-27 15:57:15:530 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::bindValue ]:	SQL bind 1 QVariant(QString, "Ariana Grande")
2020-12-27 15:57:15:530 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::exec ]:	SQL exec "SELECT lastTryEtag, lastTryModtime, retrycount, errorstring, lastTryTime, ignoreDuration, renameTarget, errorCategory FROM blacklist WHERE path=?1 COLLATE NOCASE"
...
2020-12-27 15:57:15:715 [ debug nextcloud.sync.statustracker ]	[ OCC::SyncFileStatusTracker::slotAboutToPropagate ]:	Investigating "Ariana Grande" 0 8
...
2020-12-27 15:57:15:776 [ info nextcloud.sync.propagator ]:	Starting INSTRUCTION_NEW propagation of "Ariana Grande" by OCC::PropagateRemoteMkdir(0x1e02194fb00)
2020-12-27 15:57:15:776 [ debug nextcloud.sync.propagator.remotemkdir ]	[ OCC::PropagateRemoteMkdir::start ]:	"Ariana Grande"
2020-12-27 15:57:15:776 [ debug nextcloud.sync.propagator.remotemkdir ]	[ OCC::PropagateRemoteMkdir::slotStartMkcolJob ]:	"Ariana Grande"
2020-12-27 15:57:15:776 [ info nextcloud.sync.accessmanager ]:	6 "MKCOL" "http://192.168.0.200:9321/remote.php/dav/files/julius/Test/Ariana Grande" has X-Request-ID "a6a136e3-1755-46de-a34b-05eb41951d7a"
2020-12-27 15:57:15:776 [ debug nextcloud.sync.cookiejar ]	[ OCC::CookieJar::cookiesForUrl ]:	QUrl("http://192.168.0.200:9321/remote.php/dav/files/julius/Test/Ariana Grande") requests: (QNetworkCookie("oc_sessionPassphrase=hpL599rANZUyhb1qUmUiaoJvhYcM4%2F%2F93ffDHbDK6kSRVfoh2JnFn%2F9QNg8RYm6AK8mtFvgjhn1WORNFAuEGFcAoH7hPNSaE6D2vAfYXKeAlnyOdDx8KxSS1UQfnU8%2FO; HttpOnly; domain=192.168.0.200; path=/"), QNetworkCookie("nc_sameSiteCookielax=true; HttpOnly; expires=Fri, 31-Dec-2100 23:59:59 GMT; domain=192.168.0.200; path=/"), QNetworkCookie("nc_sameSiteCookiestrict=true; HttpOnly; expires=Fri, 31-Dec-2100 23:59:59 GMT; domain=192.168.0.200; path=/"), QNetworkCookie("oc2zedli3vgt=76b4f72516fe5993fff32308eda21c0d; HttpOnly; domain=192.168.0.200; path=/"))
2020-12-27 15:57:15:776 [ info nextcloud.sync.networkjob ]:	OCC::MkColJob created for "http://192.168.0.200" + "/Test/Ariana Grande" "OCC::PropagateRemoteMkdir"
...
2020-12-27 15:57:17:105 [ info nextcloud.sync.networkjob.mkcol ]:	MKCOL of QUrl("http://192.168.0.200:9321/remote.php/dav/files/julius/Test/Ariana Grande") FINISHED WITH STATUS "OK"
2020-12-27 15:57:17:105 [ debug nextcloud.sync.fileitem ]	[ OCC::SyncFileItem::toSyncJournalFileRecordWithInode ]:	"D:/Nextcloud/Julius Files/Musik/Interpreten/Ariana Grande" Retrieved inode  10636 (previous item inode:  10636 )
2020-12-27 15:57:17:105 [ info nextcloud.sync.database ]:	Updating file record for path: "Ariana Grande" inode: 10636 modtime: 1550598538 type: 2 etag: "" fileId: "00130993oc2zedli3vgt" remotePerm: "" fileSize: 0 checksum: "" e2eMangledName: "" isE2eEncrypted: false
2020-12-27 15:57:17:105 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::bindValue ]:	SQL bind 1 QVariant(qlonglong, -778157806121197707)
2020-12-27 15:57:17:105 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::bindValue ]:	SQL bind 2 QVariant(int, 13)
2020-12-27 15:57:17:105 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::bindValue ]:	SQL bind 3 QVariant(QByteArray, "Ariana Grande")
2020-12-27 15:57:17:105 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::bindValue ]:	SQL bind 4 QVariant(qulonglong, 10636)
2020-12-27 15:57:17:105 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::bindValue ]:	SQL bind 5 QVariant(int, 0)
2020-12-27 15:57:17:105 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::bindValue ]:	SQL bind 6 QVariant(int, 0)
2020-12-27 15:57:17:105 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::bindValue ]:	SQL bind 7 QVariant(int, 0)
2020-12-27 15:57:17:105 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::bindValue ]:	SQL bind 8 QVariant(qlonglong, 1550598538)
2020-12-27 15:57:17:105 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::bindValue ]:	SQL bind 9 QVariant(int, 2)
2020-12-27 15:57:17:105 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::bindValue ]:	SQL bind 10 QVariant(QByteArray, "")
2020-12-27 15:57:17:105 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::bindValue ]:	SQL bind 11 QVariant(QByteArray, "00130993oc2zedli3vgt")
2020-12-27 15:57:17:105 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::bindValue ]:	SQL bind 12 QVariant(QByteArray, "")
2020-12-27 15:57:17:105 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::bindValue ]:	SQL bind 13 QVariant(qlonglong, 0)
2020-12-27 15:57:17:105 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::bindValue ]:	SQL bind 14 QVariant(int, 0)
2020-12-27 15:57:17:105 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::bindValue ]:	SQL bind 15 QVariant(QByteArray, "")
2020-12-27 15:57:17:105 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::bindValue ]:	SQL bind 16 QVariant(int, 0)
2020-12-27 15:57:17:105 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::bindValue ]:	SQL bind 17 QVariant(QByteArray, "")
2020-12-27 15:57:17:105 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::bindValue ]:	SQL bind 18 QVariant(bool, false)
2020-12-27 15:57:17:105 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::exec ]:	SQL exec "INSERT OR REPLACE INTO metadata (phash, pathlen, path, inode, uid, gid, mode, modtime, type, md5, fileid, remotePerm, filesize, ignoredChildrenRemote, contentChecksum, contentChecksumTypeId, e2eMangledName, isE2eEncrypted) VALUES (?1 , ?2, ?3 , ?4 , ?5 , ?6 , ?7,  ?8 , ?9 , ?10, ?11, ?12, ?13, ?14, ?15, ?16, ?17, ?18);"
2020-12-27 15:57:17:105 [ debug nextcloud.sync.database.sql ]	[ OCC::SqlQuery::exec ]:	Last exec affected 1 rows.
2020-12-27 15:57:17:105 [ info nextcloud.sync.propagator ]:	Completed propagation of "Ariana Grande" by OCC::PropagateRemoteMkdir(0x1e02194fb00) with status 4
2020-12-27 15:57:17:105 [ debug nextcloud.sync.statustracker ]	[ OCC::SyncFileStatusTracker::slotItemCompleted ]:	Item completed "Ariana Grande" 4 8
2020-12-27 15:57:17:105 [ warning nextcloud.gui.activity ]:	Item  "Ariana Grande"  retrieved resulted in  ""
2020-12-27 15:57:17:105 [ warning nextcloud.gui.activity ]:	Item  "Ariana Grande"  retrieved successfully.
2020-12-27 15:57:17:105 [ info nextcloud.gui.activity ]:	Successfully added to the activity list:  ""
2020-12-27 15:57:17:107 [ debug nextcloud.sync.networkjob ]	[ OCC::AbstractNetworkJob::slotFinished ]:	Network job OCC::MkColJob finished for "/Test/Ariana Grande"

Don’t hesitate to ask me for further details or to share tips to me to further narrow down this error!

I further inspected the sync database. It seems that the metadata file contains information about all files. In this list all the files that failed to sync are not listed. This is probably a nextcloud-thing. I will now further inspect if I can get my hands on this sync-job to modify the entries of all wrongly synced directories.
What kind of factors can actually result in an error like this? Does Windows may have problems specifying the file type or is it a disk error?

after fresh install of 20.0.4 i encounter the same problems, if i make a file on pc2 in a synced folder pc1 gets access denied.

alright, strange thing i found (for me), if i remove the extention from the file name (test.txt > test) it sync’s without problem between pc’s…could be that win10 lock’s the file even after it being closed and thus preventing proper sync?

Did you take a look into the client log to further explore what causes the error in the first place?

i managed to fix it the following way:

  1. make nextcloud folder under my windows C:\Users\Spencer folder
  2. link all libraries in win 10 to that folder and sync
  3. do the same on other computers
  4. no more sync problems…

For some reason it (it: not sure if its the client the server or windows 10) does not like it if you directly sync the " original" libraries of windows…if you move the libraries to a separate folder then its no problem

What do you mean in your case with libraries?

For example the folder Documents, is a so called library folder…you can move it (see link)

After trying to upload every single folder one by one I noticed some kind of regularity. In most of the folders that were skipped, there was a subfolder ‘.wdmc’ in it, which was created from my old hardrive containing smaller image versions of the original files. I removed those folders recursively using Python and hope, that the next sync will now be able to include all files.

edit: sadly, it did not resolve the issue

@Arcadia you’re not alone.

I had the same exact problem, confirmed by reading the logs.
I’m using the client version 3.1.3 (Windows). (And server 20.0.7 on Ubuntu 20.04 if that’s useful)

After finding your post and before posting a reply I tried many things and I was able to solve it eventually.

The 2 things I did before checking again if the problem was solved were:

Install and sync the latest owncloud client (despite warning that the server version is not supported it works) and install the latest RC1 nextcloud client (msi64 from Index of /desktop/releases/Windows), that I think it’s only command line based so then I reinstalled the normal 3.1.3 and the problem was solved.

I think what solved the problem was the sync with the owncloud client, but I can’t be sure of it.
If that doesn’t solve the problem, it might be something the RC1 did during the installation when it required to stop explorer.exe

Try it and be sure to restart your pc everytime it is asked of you.
(You can install owncloud without uninstalling the nextcloud client, simply quit it and disable the auto startup)

Best of luck!

PS: I haven’t uninstalled owncloud yet, simply left it disabled after I removed the folder sync, call it superstition if you wish… or maybe I’m simply exhausted after so many tries that I don’t want to do it all again in case the owncloud client does something to windows explorer… :slight_smile:

Hey ZioTron!

Many many thanks for your message. I directly tried out your ideas after I read them. First of all I tried out the new release candidate (3.2 RC1) for the desktop client. Actually I didn’t get it to start and was a bit confused so I just let that be and reinstalled 3.1.3 and everything did not work as before.

I tried out Owncloud next and tried to sync a new folder there, were everything worked fine. After I disabled it I tried the same with Nextcloud and now it worked there too. Hopefully this scales up for all my files but we will see.
As it works without an issue with the Owncloud Version I guess I just stick to that for now.