Onedrive sync: Could not execute request after multiple attempts

I am using Joplin 2.6.10 (Windows) and Onedrive for syncing. Recently I have been getting the below error when trying to sync my notes:

Could not execute request after multiple attempts: GET https://graph.microsoft.com/v1.0/drive/root:/Apps/Joplin/7e71be77c09043c89c15dd204c247b4f.md:/content

Below are the errors I received from log.txt

2022-01-19 19:28:33: OneDriveApi: "Got error below - retrying (0)..."
2022-01-19 19:28:33: OneDriveApi: "FetchError: request to https://graph.microsoft.com/v1.0/drive/root:/Apps/Joplin/info.json:/content failed, reason: getaddrinfo ENOTFOUND graph.microsoft.com
Code: ENOTFOUND
FetchError: request to https://graph.microsoft.com/v1.0/drive/root:/Apps/Joplin/info.json:/content failed, reason: getaddrinfo ENOTFOUND graph.microsoft.com
    at ClientRequest.<anonymous> (C:\Users\user\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\@joplin\lib\node_modules\node-fetch\index.js:133:11)
    at ClientRequest.emit (events.js:376:20)
    at TLSSocket.socketErrorListener (_http_client.js:475:9)
    at TLSSocket.emit (events.js:376:20)
    at emitErrorNT (internal/streams/destroy.js:106:8)
    at emitErrorCloseNT (internal/streams/destroy.js:74:3)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)"
2022-01-19 19:28:33: "ResourceService::deleteOrphanResources:", "[]"

2022-01-20 08:03:27: checkForUpdates: "FetchError: request to https://api.github.com/repos/laurent22/joplin/releases failed, reason: getaddrinfo ENOTFOUND api.github.com
Code: ENOTFOUND
FetchError: request to https://api.github.com/repos/laurent22/joplin/releases failed, reason: getaddrinfo ENOTFOUND api.github.com
    at ClientRequest.<anonymous> (C:\Users\user\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\@joplin\lib\node_modules\node-fetch\index.js:133:11)
    at ClientRequest.emit (events.js:376:20)
    at TLSSocket.socketErrorListener (_http_client.js:475:9)
    at TLSSocket.emit (events.js:376:20)
    at emitErrorNT (internal/streams/destroy.js:106:8)
    at emitErrorCloseNT (internal/streams/destroy.js:74:3)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)"
2022-01-20 08:03:27: checkForUpdates: "Done."

And this is the error I received from devtools after enabling debugging:

C:\Users\user\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\@joplin\lib\Logger.js:188 21:00:28: Synchronizer: Error: Could not execute request after multiple attempts: GET https://graph.microsoft.com/v1.0/drive/root:/Apps/Joplin/7e71be77c09043c89c15dd204c247b4f.md:/content

C:\Users\user\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\@joplin\lib\Logger.js:188 21:05:37: OneDriveApi: Got error below - retrying (0)...
C:\Users\user\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\@joplin\lib\Logger.js:188 21:05:37: OneDriveApi: SyntaxError: OneDriveApi::exec: Cannot parse JSON error:  Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at OneDriveApi.<anonymous> (C:\Users\user\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\@joplin\lib\onedrive-api.js:299)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\user\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\@joplin\lib\onedrive-api.js:5)
    at processTicksAndRejections (internal/process/task_queues.js:95)

I have been experiencing the same syncing errors on both of my devices running Joplin. I also tried disabling syncing and resyncing with onedrive but this hasn't helped.

Hi, thanks for the logs,

There might be several reasons, but in worst case you'd need a backup, do you have one?

Reasons

  • some internal OneDrive API is limiting the calls. The service shouldn't do that (unless it's OneDrive for business which is not supported) but if it indeed happen —

Potential solution: you can just wait for a day and try again

  • Max concurrent connections are too high or too low

Potential solution: try changing Tools > Options > Synchronisation > Show advanced settings > Max concurrent connections to 2, try syncing again and if it doesn't work change to 8

  • the database is incomplete :fearful:. Something has tampered with Joplin's files. For example, sync engine of OneDrive might have got confused and deleted or restored a file when it shouldn't have

Potential solution: look in trashcan at sync target, restore any joplin file you find and try syncing again.

  • OneDrive just doesn't work for you for some other reason

Potential solution: Reupload the Joplin data to another cloud provider

  • Change the sync target to any other cloud, fill your credentials
  • Tools > Options > Synchronisation > Show advanced settings > Re-Upload local data to sync target
  • Wait patiently till the process is complete

There might be several reasons, but in worst case you'd need a backup, do you have one?
I don't have one, but can access the existing notes within Joplin.

I tried the mentioned steps except the last one for using another cloud provider, but they weren't successful. Without a back up, can I still reupload the local data to another cloud provider without losing data?

Technically you can do it, there not supposed to be a data loss, but if lightning strikes, windows decides to restart itself or any other unfortunate event happen that may corrupt your database, you'd be out of options and potentially with broken database (all your notes).
Morally, I cannot recommend you to do anything substantial without a backup, but when reuploading there shouldn't be destructive operations involved.

Out of curiosity, is there a strong reason not to make a .jex backup though?

Out of curiosity, is there a strong reason not to make a .jex backup though?

I initially thought that I needed a previous backup in order to perform the steps you mentioned, but have since made a backup of my notes.

So I was able to re-upload my notes to another cloud provider without any errors, using the 'Re-Upload local data to sync target' option, thanks to your advice. Should I use this same re-upload local data option on other devices? Each of my devices has some notes that never got synced to other devices after I experienced the onedrive sync issue.

No, this is one way upload that will replace all data on the sync target. Best case is to try to merge changes made from other devices.

To do that, you just change the sync target to the new one on an unsynced device and let it sync.

Depending on how large the changes were on mobile device, It might potentially delete something or mark all your notes as conflicts, so export of the profile (mobile backup) is a must.

Well, in ideal situation it shouldn't do anything weird, this is just more risky step than "reupload" you performed before.

unless it's OneDrive for business which is not supported

@graphit0 OneDrive for Business is supported!

1 Like

Thank you Johnny for the correction and for the PR. indeed, I can see it now.


For anyone wondering what's the debacle with OneDrive for business: thanks to @johnny's contribution we currently can work with it

1 Like

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