zadam / trilium

Build your personal knowledge base with Trilium Notes
GNU Affero General Public License v3.0
27.2k stars 1.9k forks source link

(Bug report) Cannot sync desktop instance to server - Error: Entity recent_notes 0EhOu4epck9Z not found. #2842

Closed ElPistoler0 closed 2 years ago

ElPistoler0 commented 2 years ago

Trilium Version

0.51.2

What operating system are you using?

Other Linux

What is your setup?

Local + server sync

Operating System Version

Windows 11 21H2 desktop, dietPi Linux 8.4.2 server

Description

Trying to set up initial sync from my desktop app (Win11 21H2) to my server (dietPi Linux 8.4.2) and I keep getting this error:

Error: Entity recent_notes 0EhOu4epck9Z not found.

Here's the stack trace:

200 POST /api/login/sync with 55 bytes took 1ms Returning 721 entity changes in 28ms Slow 200 GET /api/sync/changed?instanceId=RJo8Czk4CarD&lastEntityChangeId=0&logMarkerId=yZpIJ00fUG with 1800477 bytes took 45ms Returning 43 entity changes in 15ms Slow 200 GET /api/sync/changed?instanceId=RJo8Czk4CarD&lastEntityChangeId=757&logMarkerId=4Qav9I5WCO with 1147939 bytes took 26ms Returning 213 entity changes in 15ms Slow 200 GET /api/sync/changed?instanceId=RJo8Czk4CarD&lastEntityChangeId=800&logMarkerId=zGtdLsG1Vx with 1017343 bytes took 23ms Returning 61 entity changes in 13ms Slow 200 GET /api/sync/changed?instanceId=RJo8Czk4CarD&lastEntityChangeId=1013&logMarkerId=GeYnzEMfDa with 1087632 bytes took 22ms Returning 118 entity changes in 14ms Slow 200 GET /api/sync/changed?instanceId=RJo8Czk4CarD&lastEntityChangeId=1074&logMarkerId=O99fnoYOAS with 1032904 bytes took 23ms ERROR: get /api/sync/changed threw exception: Error: Entity recent_notes 0EhOu4epck9Z not found. at getEntityChangeRow (/usr/src/app/src/services/sync.js:320:19) at Object.getEntityChangeRecords (/usr/src/app/src/services/sync.js:346:24) at getChanged (/usr/src/app/src/routes/api/sync.js:150:45) at Function.cb (/usr/src/app/src/routes/routes.js:154:34) at Function.sqliteTransaction (/usr/src/app/node_modules/better-sqlite3/lib/methods/transaction.js:65:24) at Object.transactional (/usr/src/app/src/services/sql.js:236:52) at /usr/src/app/src/routes/routes.js:156:44 at /usr/src/app/node_modules/cls-hooked/context.js:118:13 at Namespace.run (/usr/src/app/node_modules/cls-hooked/context.js:97:5) at Namespace.runAndReturn (/usr/src/app/node_modules/cls-hooked/context.js:117:8) 200 GET /api/app-info with 269 bytes took 1ms

I tried searching for the note with ID 0EhOu4epck9Z, but found nothing.

How can I force a full sync from my desktop client?

Thanks!

F.

zadam commented 2 years ago

Hi, thanks for reporting this issue. It looks like there's some remnant of old data in your database which prevents the sync from working. I added a DB migration to clean that up so that it doesn't cause problems in the future.

In the meantime, open an SQL Console:

image

And execute the following query:

DELETE FROM entity_changes WHERE entityName = 'recent_notes';

After that the sync should work.

Hopefully this will help.

ElPistoler0 commented 2 years ago

Thank you!