floccus icon indicating copy to clipboard operation
floccus copied to clipboard

Auto-Sync to root folder no longer possible

Open cegfault opened this issue 4 months ago • 14 comments

Which version of floccus are you using?

5.7.0

How many bookmarks do you have, roughly?

300

Are you using other means to sync bookmarks in parallel to floccus?

No

Sync method

Nextcloud Bookmarks

Which browser are you using? In case you are using the phone App, specify the Android or iOS version and device please.

Firefox 143.0

Which version of Nextcloud Bookmarks are you using? (if relevant)

15.2.0

Which version of Nextcloud? (if relevant)

31.0.9.1

What kind of WebDAV server are you using? (if relevant)

No response

Describe the Bug

When creating/importing the profile where the localRoot folder is the main/root folder in the browser ("/" aka "root________") and auto-sync is enabled, the following occurs: (1) the bookmarks sync on the first sync (2) The "Local target" bookmark folder automatically changes to "Folder Not Found/" (3) On the second sync, a warning is displayed that 100% of the bookmarks will be either added or deleted (4) The "Local target" bookmark folder changes to "Bookmarks Menu/Floccus (label)" (5) All the bookmarks become synchronized into that subfolder (and the bookmarks are still in the main "Bookmarks Menu" folder - they are now listed twice)

floccus-5.7.0-2025-09-16-redacted.log

Expected Behavior

For the bookmarks to properly synchronize to the browser's main folder, and NOT for a subfolder/profile folder to be created

To Reproduce

  • fresh install of firefox
  • install floccus addon
  • modify then import this json with your nextcloud bookmarks url and username/password:
[
  {
    "localRoot": "root________",
    "strategy": "default",
    "syncInterval": 15,
    "nestedSync": true,
    "failsafe": true,
    "allowNetwork": false,
    "label": "main",
    "errorCount": 0,
    "clickCountEnabled": false,
    "type": "nextcloud-bookmarks",
    "url": "[[YOUR_URL]]",
    "username": "[[YOUR_USERNAME]]",
    "password": "[[YOUR_PASSWORD]]",
    "serverRoot": "[[WHATEVER]]",
    "includeCredentials": false,
    "allowRedirects": false,
    "enabled": true,
    "syncing": false,
    "error": null,
    "lastSync": 0,
    "scheduled": false,
    "rootPath": "/"
  }
]

Debug log provided

  • [x] I have provided a debug log file

cegfault avatar Sep 16 '25 23:09 cegfault

Hello! :wave:

Thank you for taking the time to open this issue with floccus. I know it's frustrating when software causes problems. You have made the right choice to come here and open an issue to make sure your problem gets looked at and if possible solved. Let me give you a short introduction on what to expect from this issue tracker to avoid misunderstandings. I'm Marcel. I created floccus a few years ago, and have been maintaining it since. I currently work for Nextcloud which leaves me with less time for side projects like this one than I used to have. I still try to answer all issues and if possible fix all bugs here, but it sometimes takes a while until I get to it. Until then, please be patient. It helps when you stick around to answer follow up questions I may have, as very few bugs can be fixed directly from the first bug report, without any interaction. If information is missing in your bug report and the issue cannot be solved without it, I will have to close the issue after a while. Note also that GitHub in general is a place where people meet to make software better together. Nobody here is under any obligation to help you, solve your problems or deliver on any expectations or demands you may have, but if enough people come together we can collaborate to make this software better. For everyone. Thus, if you can, you could also have a look at other issues to see whether you can help other people with your knowledge and experience. If you have coding experience it would also be awesome if you could step up to dive into the code and try to fix the odd bug yourself. Everyone will be thankful for extra helping hands! If you cannot lend a helping hand, to continue the development and maintenance of this project in a sustainable way, I ask that you donate to the project when opening an issue (or at least once your issue is solved), if you're not a donor already. You can find donation options at https://floccus.org/donate/. Thank you!

One last word: If you feel, at any point, like you need to vent, this is not the place for it; you can go to the Nextcloud forum, to twitter or somewhere else. But this is a technical issue tracker, so please make sure to focus on the tech and keep your opinions to yourself.

Thank you for reading through this primer. I look forward to working with you on this issue! Cheers! :blue_heart:

github-actions[bot] avatar Sep 16 '25 23:09 github-actions[bot]

A few things worth noting:

  1. The JSON snippet above was working fine until a floccus update; I'm not sure which as I just discovered this bug today.
  2. This issue does not occur when "Auto-Sync" is off/disabled. Manual syncs work fine.
  3. In debugging I deleted all bookmarks in Nextcloud Bookmarks and created a fresh firefox profile to do the import, still with this bug. In other words, there are no issues with the bookmark version updates or syncing from an older version to a new one, as I explicitly started fresh to remove that as a possibility. Thanks for making a great plugin - I hope we can get auto-sync working again soon! :)

cegfault avatar Sep 16 '25 23:09 cegfault

Hi @cegfault Thank you for taking the time to give feedback! I'll try to get to the bottom of this with your help :)

Manual syncs work fine.

So, the first sync and second sync in your bug description is not a manual sync, but automatic syncs triggered by the timer / a local change?

marcelklehr avatar Sep 19 '25 09:09 marcelklehr

I tried to reproduce this with the following steps:

  1. Create a root folder profile and make sure it syncs
  2. Export the profile
  3. Delete the profile
  4. Re-import the profile
  5. Sync first time (clicking on sync manually)
  6. Sync a second time (clicking on sync manually)

The result is: The profile is still intact, no failsafe error and no changed local target. I did use the webdav sync method, though, not Nextcloud Bookmarks. Will try to reproduce with a fresh Nextcloud Bookmarks next.

marcelklehr avatar Sep 19 '25 10:09 marcelklehr

So, the first sync and second sync in your bug description is not a manual sync, but automatic syncs triggered by the timer / a local change?

Correct - the first sync is occurs when firefox is first opened (on a clean/new profile). The second sync is occurring on the default auto-sync timer (15 mins). I do get the same result if auto-sync is on and I click the button to sync.

If, however, I have auto-sync off, then when the clean/new profile opens, the first syn is a manual sync down (down-arrow button). Subsequent (second/third/etc) syncs with the "sync" button (which must be manually pressed because auto-sync is off) operate as expected.

Now that I'm writing this out, it's possible the first sync is actually the issue - an empty profile with no bookmarks in it might be doing "sync" button different than "down" button, but you would know and I definitely would not lol.

Regard webdavs/nextcloud-bookmarks, I've never used floccus with anything except nextcloud bookmarks on a self-hosted/private nextcloud server. I have not thought to test other methods.

cegfault avatar Sep 20 '25 02:09 cegfault

I'm sorry, I also cannot reproduce this with a fresh Firefox 143 profile and a fresh Nextcloud Bookmarks 15.2.0 instance.

marcelklehr avatar Sep 21 '25 09:09 marcelklehr

Weird; I'm still having the problem. It does look like your reproduction steps are different than mine; you are beginning with a firefox profile that has already synchronized and are deleting/re-importing it.

What I'm doing:

  • fresh firefox profile:
mkdir test
cp prefs.js test/prefs.js  ## I need a proxy server to access my private nextcloud service
firefox --profile test/ "https://addons.mozilla.org/en-US/firefox/addon/floccus/"
  • click add to firefox, allow to run in private windows
  • addons > floccus > import ... please copy-paste this specific json to your test file:
[
  {
    "localRoot": "root________",
    "strategy": "default",
    "syncInterval": 15,
    "nestedSync": true,
    "failsafe": true,
    "allowNetwork": false,
    "label": "main",
    "errorCount": 0,
    "clickCountEnabled": false,
    "type": "nextcloud-bookmarks",
    "url": "[[YOUR_URL]]",
    "username": "[[YOUR_USERNAME]]",
    "password": "[[YOUR_PASSWORD]]",
    "serverRoot": "[[WHATEVER]]",
    "includeCredentials": false,
    "allowRedirects": false,
    "enabled": true,
    "syncing": false,
    "error": null,
    "lastSync": 0,
    "scheduled": false,
    "rootPath": "/"
  }
]
  • addons > floccus > sync button (works, syncs all bookmarks)
  • addons > floccus > sync button (now gives failsafe error)

cegfault avatar Sep 22 '25 22:09 cegfault

I had attached debug logs with my initial bug report, but the exact result of of the steps in my immediate comment above resulted in the log attached to this comment.

The only changes I made to the log is replacing my nextcloud base url with [[NEXTCLOUD]] for privacy and the lines listing the bookmarks/urls were deleted for privacy (two [[DELETED X LINES]] in the attached log). floccus-5.7.0-2025-09-22-full.log

It's clear bookmarks are synchronized on the first sync (line 28-40 in the attached log):

2025-09-22T22:28:35.043Z LOADCHILDREN     + #371[Bookmarks Menu] parentId: 330, hash: undefined
      [[DELETED 2655 LINES]]
2025-09-22T22:28:35.049Z Calculating diff for      + #menu________[Bookmarks Menu] parentId: root________, hash: undefined
      [[DELETED 864 LINES]]
2025-09-22T22:28:35.056Z Calculating diff for      + #toolbar_____[Bookmarks Bar] parentId: root________, hash: undefined
     + #376[Bookmarks Bar] parentId: 330, hash: undefined

2025-09-22T22:28:35.057Z Calculating diff for      + #unfiled_____[Other Bookmarks] parentId: root________, hash: undefined
     + #377[Other Bookmarks] parentId: 330, hash: undefined

2025-09-22T22:28:35.057Z Calculating diff for      + #mobile______[Mobile Bookmarks] parentId: root________, hash: undefined
     + #378[Mobile Bookmarks] parentId: 330, hash: undefined

And then the second sync is giving the failsafe:

2025-09-22T22:28:35.057Z Scanner: Finding moves
2025-09-22T22:28:35.057Z Scanner: Generate reorders
2025-09-22T22:28:35.057Z { localScanResult: 
   { CREATE: 
      Diff
      ,
     UPDATE: 
      Diff
      ,
     MOVE: 
      Diff
      ,
     REMOVE: 
      Diff
      
      Action: REMOVE
      Payload: #menu________[Bookmarks Menu] parentId: root________ Index: 0
      
      
      Action: REMOVE
      Payload: #toolbar_____[Bookmarks Bar] parentId: root________ Index: 1
      
      
      Action: REMOVE
      Payload: #unfiled_____[Other Bookmarks] parentId: root________ Index: 2
      
      
      Action: REMOVE
      Payload: #mobile______[Mobile Bookmarks] parentId: root________ Index: 3
      ,
     REORDER: 
      Diff
       },
  serverScanResult: 
   { CREATE: 
      Diff
      ,
     UPDATE: 
      Diff
      ,
     MOVE: 
      Diff
      ,
     REMOVE: 
      Diff
      ,
     REORDER: 
      Diff
       } }
2025-09-22T22:28:35.057Z Reconciling diffs to prepare a plan for Server
2025-09-22T22:28:35.057Z Reconciling diffs to prepare a plan for Local
2025-09-22T22:28:35.057Z Mapping server plan
2025-09-22T22:28:35.059Z Mapping local plan
2025-09-22T22:28:35.059Z { localPlan: 
   { CREATE: 
      Diff
      ,
     UPDATE: 
      Diff
      ,
     MOVE: 
      Diff
      ,
     REMOVE: 
      Diff
      ,
     REORDER: 
      Diff
       },
  serverPlan: 
   { CREATE: 
      Diff
      ,
     UPDATE: 
      Diff
      ,
     MOVE: 
      Diff
      ,
     REMOVE: 
      Diff
      
      Action: REMOVE
      Payload: #371[Bookmarks Menu] parentId: 330 Index: 0
      
      
      Action: REMOVE
      Payload: #376[Bookmarks Bar] parentId: 330 Index: 1
      
      
      Action: REMOVE
      Payload: #377[Other Bookmarks] parentId: 330 Index: 2
      
      
      Action: REMOVE
      Payload: #378[Mobile Bookmarks] parentId: 330 Index: 3
      ,
     REORDER: 
      Diff
       } }
2025-09-22T22:28:35.059Z Checking deletion failsafe: 0/0=NaN
2025-09-22T22:28:35.059Z Checking addition failsafe: 0/0=NaN
2025-09-22T22:28:35.059Z Checking deletion failsafe: 426/426=1
2025-09-22T22:28:35.060Z Syncing failed with E029: Failsafe: The current sync run would delete 100% of your links. Refusing to execute. Disable this failsafe in the account settings if you want to proceed anyway.
2025-09-22T22:28:35.060Z QUEUING DELETE [[NEXTCLOUD]]/index.php/apps/bookmarks/public/rest/v2/lock
2025-09-22T22:28:35.060Z FETCHING DELETE [[NEXTCLOUD]]/index.php/apps/bookmarks/public/rest/v2/lock
2025-09-22T22:28:35.092Z Receiving response for DELETE [[NEXTCLOUD]]/index.php/apps/bookmarks/public/rest/v2/lock

cegfault avatar Sep 22 '25 22:09 cegfault

Finally, to verify manual sync works:

  • new firefox profile:
rm -rf test
mkdir test
cp prefs.js test/prefs.js  ## I need a proxy server to access my private nextcloud service
firefox --profile test/ "https://addons.mozilla.org/en-US/firefox/addon/floccus/"
  • click add to firefox, allow to run in private windows
  • addons > floccus > import (same json as above except change "enabled": true to "enabled": false)
  • addons > floccus > DOWN button (NOT the "sync" button as above! - works, syncs all bookmarks)
  • addons > floccus > sync button (no error)
  • addons > floccus > sync button again (no error)
  • addons > floccus > sync button again again (no error)

cegfault avatar Sep 22 '25 22:09 cegfault

Fair enough, I followed your updated reproduction steps. But for me setting enabled: true in the JSON doesn't lead to the profile's auto-sync setting being enabled, because floccus internally resets it to false upon import to make sure people check the imported settings, so here's the steps I followed:

What I'm doing:

  • fresh firefox profile:
mkdir test
# no proxy for me
firefox --profile test/ "https://addons.mozilla.org/en-US/firefox/addon/floccus/"
  • click add to firefox, allow to run in private windows
  • addons > floccus > import ... please copy-paste this specific json to your test file:
[
  {
    "localRoot": "root________",
    "strategy": "default",
    "syncInterval": 15,
    "nestedSync": true,
    "failsafe": true,
    "allowNetwork": false,
    "label": "main",
    "errorCount": 0,
    "clickCountEnabled": false,
    "type": "nextcloud-bookmarks",
    "url": "http://localhost:8080",
    "username": "admin",
    "password": "admin",
    "serverRoot": "",
    "includeCredentials": false,
    "allowRedirects": false,
    "enabled": true,
    "syncing": false,
    "error": null,
    "lastSync": 0,
    "scheduled": false,
    "rootPath": "/"
  }
]
  • addons > floccus > options > set auto-sync to enabled -> safe
  • addons > floccus > sync button (-> works)
  • addons > floccus > sync button (-> works)

marcelklehr avatar Sep 24 '25 14:09 marcelklehr

Even if I don't set auto-sync to enabled manually it works fine. 🤔

Could you reveal some of these lines:

[[DELETED 2655 LINES]]

There should be some lines for serverTree, localTree and most importantly cacheTree which would be interesting to see, with private stuff redacted of course!

marcelklehr avatar Sep 24 '25 15:09 marcelklehr

I'm currently dealing with the server-side's lack of Nextloud 32 support ... I will re-generate logs and do more testing once that's fixed :)

cegfault avatar Sep 28 '25 22:09 cegfault

New log; all lines included but bookmark names/urls replaced with "PRIVATE" and my nextcloud url replaced with "[[NEXTCLOUD_URL]]":

floccus-5.7.0-2025-10-01-full.log

My server has been upgraded to Nextcloud 32. Thanks for the help!

cegfault avatar Oct 01 '25 23:10 cegfault

Okay, I think I have this figured out!

In the log above + #TAq5r99Kkm8D[undefined] parentId: undefined, hash: undefined followed by 2025-10-01T23:36:10.122Z Calculating diff for + #TAq5r99Kkm8D[undefined] parentId: undefined, hash: undefined seems to be the attempt to understand the folder with hash #TAq5r99Kkm8D as the root -- the server having no bookmarks in the folder and the client then misplacing the root________ folder underneath it makes no sense. Of note, this folder has the name "Floccus (main)" (which I did not create). I tried deleting that folder and pressing the manual "up" button to sync to the server, which gives the error "Syncing failed with E038: Could not find local folder" (log: floccus-5.7.0-2025-10-02-full.log).

So I logged onto the server and manually deleted all folders underneath menu________, created a clean firefox profile, and the auto-sync recreated "Floccus (main)" folder and did not place it underneath root________ (see line #458 of full log: floccus-5.7.0-2025-10-02-full attempt2.log). Again, I deleted the folder locally then pressed the "up" button and got the same error - Syncing failed with E038: Could not find local folder (see that log: floccus-5.7.0-2025-10-02-full attempt2 delete.log)

So this seems to be an issue with creating a default folder for the bookmarks. I tried digging around the source code, but don't have anymore time to work on this today. If you can point me in the right direction I'm happy to look around.

cegfault avatar Oct 02 '25 00:10 cegfault