#8735·syncthing

Incorrect local state when using `!` negated ignore patterns combined with parent folder ignored

Author: tomasz1986Created Dec 30, 2022Updated Aug 26, 2026
Labelsbug

I believe this is likely responsible for the long-term issue I've been experiencing since basically forever which leads to non-matching local and remote folder states despite using the exact same ignore patterns on both sides.

  1. Share an empty folder between Device 1 (D1) and Device 2 (D2).
  2. Set the folder to "Send & Receive" on both sides.
  3. Add the following ignore patterns to the folder on both sides.
    !*.txt
    /
    
  4. The folders on both sides should now look as follows.
  5. Create the following hierarchy in the folder on D1.
    /folder
    /folder/file.txt
    
  6. Scan the folder on D1. Wait for the changes to sync to D2.
  7. The final state looks as follows.
  8. As you can see, the folder state on D1 is incorrect. Because file.txt is present inside /folder, the folder should be included in the local state as well, however in reality only the file is. Once this happens, neither rescanning the folder nor restarting Syncthing repairs the broken local state.

There is a caveat though. The steps above aren't complete. I've just managed to reproduce this in my test environment and I'm attaching logs with model,db enabled below, however in my testing I was repeatedly creating and removing folders and files in order to find the culprit. While doing so, I eventually managed to reach the state as seen above, but I can't reproduce it at will directly yet.

The logs should contain the relevant information though. They aren't very large either, as the whole testing took less than 10 minutes or so.

syncthing1.log syncthing2.log

For the record, I think the actual synchronisation still functions fine despite the incorrect local states. However, I've encountered problems with Receive Only folders being stuck in a permanent "Out of Sync" state which I believe is likely related to this very bug. I still haven't been able to reproduce that one in my test environment though.