winapi error #5 new files aren't indexed

I noticed that about two weeks ago my new files stoped syncing with other devices. Every new file created or modified in my machine won’t get indexed locally, and when I rescan the directory, all of them return the error “winapi error #5”. I tried removing a shared folder and re-create it, and it turns out that it won’t index ANY file. It picks up the directory structure, but NO files are indexed. All of them with the same error. Hashing: open and Winapi error #5. I browsed the forums and looked for a solution, but I coudn’t find anything. This is happening only in one of my computers, that runs Windows 11. It doesn’t have anything to do with long paths as it still happens with any file on top-level directories, I don’t think it’s a firewall or antivirus thing, as I tried turning them off and the problem persists.

Any help?

If I recall correctly, that error would indicate a lack of required rights. So, firstly I’d double check if the user which Syncthing is running as has the correct permissions/rights to read the relevant files.

It doesn’t seem to be the case. All the files are accessible and were accesible before, no changes. I removed and recreated a share without changing any files in the directory, and still the files couldn’t be indexed (none of them was indexed). Considering that, it doesn’t seem to be something related to files ownership/permissions.

It looks like this instance of Syncthing stopped indexing files since march 15. Any file that tries to be indexed in a later date returns the same error.

Is it possible that Windows doesn’t let ST access the files?

Some progress: The issue seems to have been introduced in 1.23.2 I rolled back to 1.23.1 and it works as expected. I tried 1.23.3 rc1 and the problem persists.

I can’t think of any changes since 1.23.1 that would have any effect on this.

Maybe different Go runtime versions with some change affecting this?

Where did you install Syncthing from (both versions)?

One might think, but the Windows release is still on Go 1.19 because we haven’t sorted out all the test annoyances for 1.20 yet.

It happening on just the one computer still smells like antivirus or permissions, even if those are “turned off” and double-checked…

I’m using Synctrayzor since 2016, same file structure. Synctrayzor is up to date, and it always installed the syncthing updates automatically (I’m using the default iirc, only stable releases). I never experienced this problem before, I upgraded my OS to Windows 11 this year, but syncthing worked fine after the upgrade. I didn’t install new software.

The first thing I thought when I noticed the problem was something related to the AV or firewall. I turned them off, made sure that the related services were down… and nothing. The only positive change was rolling back to 1.23.1, and files that were not being indexed started to sync. I still have to try removing and re-creating a share and see if the new files are synced or not.

The only part regarding filesystem interaction which got touched by v1.23.2:

And some minor go version bump:

The first poster to respond is correct: Windows error code 5 is “Access is denied”. The net helpmsg command line command is helpful for returning the localized language description for many error codes. On my machine (English):

PS C:\> net helpmsg 5

Access is denied.
2 Likes

Well, it looks it was the antivirus thing after all. Only after I uninstalled it completely the problem was solved. btw, a different machine (with different hardware and windows 10) started to do the same, even after rolling back to 1.23.1

I think we can conclude that it was other software messing up with the permissions, but it’s still weird, because the files that failed to sync are accessible, and I can read and write them without any issues using other software packages.

Maybe the security software is preventing only Syncthing from accessing them. At any rate, I’ll have to get in touch with them to see what’s going on. Thanks for your help everyone.

2 Likes

The only proper interaction with thirdparty AV solutions is a gentle toss in the trash can :slightly_smiling_face:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.