Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Bug report) Somehow managed to bork my Trilium instance by placing a null somewhere where it shouldn't be #3089

Closed
agentydragon opened this issue Aug 24, 2022 · 7 comments

Comments

@agentydragon
Copy link
Contributor

Trilium Version

unknown

What operating system are you using?

macOS

What is your setup?

Local + server sync

Operating System Version

Mac OS

Description

I've been playing with the backend & frontend API and I think I created a note or some other model with a null somewhere where an object would have been expected. last thing I saw were errors complaining about calling, I believe, toLowerCase on a null, and now my Trilium is a dead white screen:

Screen Shot 2022-08-24 at 4 23 19 PM

I guess the backend API could use some validation/hardening somewhere. Would appreciate help recovering the db. (I sure hope it didn't sync the bad data...)

@agentydragon
Copy link
Contributor Author

dead white screen as in the trilium frontend doesn't load at all, app is now unusable:
Screen Shot 2022-08-24 at 4 25 01 PM

@DynamoFox
Copy link
Contributor

You can try to run Trilium in safe-mode, look for trilium-safe-mode.sh script in your installation and then you should be able to find and remove the guilty note(s).
Running Trilium in safe-mode disables user scripting and in the future will prompt Electron to use software rendering too.

@agentydragon
Copy link
Contributor Author

agentydragon commented Aug 25, 2022 via email

@zadam
Copy link
Owner

zadam commented Aug 25, 2022

If the safe mode doesn't help, please post here the exception from the backend log (~/trilium-data/log/...), since the request errored out with 500

@agentydragon
Copy link
Contributor Author

here's the tail of my backend log:

16:21:22.131 200 GET /api/backend-log with 329282 bytes took 9ms
16:21:33.337 Sending message to all clients: {"type":"sync-push-in-progress","lastSyncedPush":62752}
16:21:33.338 Sync GmZu24Hjwu: Pushing 5 sync changes in 170ms
16:21:33.339 Nothing to push
16:21:33.657 Finished pull
16:21:33.657 Nothing to push
16:21:34.707 Slow query took 109ms: SELECT entityName, entityId, hash FROM entity_changes WHERE isSynced = 1 AND entityName != 'note_reordering'
16:21:34.777 Content hash computation took 179ms
16:21:34.779 Content hash checks PASSED
16:21:34.780 Sending message to all clients: {"type":"sync-finished","lastSyncedPush":62760}
16:21:37.466 JS Error: Encountered error Process exceeded time limit 30000: Error: Process exceeded time limit 30000
    at Object.timeLimit (http://127.0.0.1:37840/app-dist/desktop.js:2:94133)
    at http://127.0.0.1:37840/app-dist/desktop.js:2:101734
    at http://127.0.0.1:37840/app-dist/desktop.js:2:102408
    at WebSocket.T (http://127.0.0.1:37840/app-dist/desktop.js:2:102436), reloading frontend.
Stack: Error
    at N (http://127.0.0.1:37840/app-dist/desktop.js:2:100894)
    at http://127.0.0.1:37840/app-dist/desktop.js:2:101763
    at async http://127.0.0.1:37840/app-dist/desktop.js:2:102411
    at async WebSocket.T (http://127.0.0.1:37840/app-dist/desktop.js:2:101308)
16:21:37.519 Generated CSRF token ovXnIzwC-WMbg3bO_mmapmAVrBvIipWN1oAk with secret undefined
16:21:37.832 200 GET /api/options with 6732 bytes took 1ms
16:21:37.854 ERROR: get /api/tree threw exception: TypeError: Cannot read properties of undefined (reading 'attributeId')
    at getNotesAndBranchesAndAttributes (/Applications/Trilium Notes.app/Contents/Resources/app.asar/src/routes/api/tree.js:101:36)
    at getTree (/Applications/Trilium Notes.app/Contents/Resources/app.asar/src/routes/api/tree.js:144:12)
    at Function.cb (/Applications/Trilium Notes.app/Contents/Resources/app.asar/src/routes/routes.js:159:34)
    at Function.sqliteTransaction (/Applications/Trilium Notes.app/Contents/Resources/app.asar/node_modules/better-sqlite3/lib/methods/transaction.js:65:24)
    at Object.transactional (/Applications/Trilium Notes.app/Contents/Resources/app.asar/src/services/sql.js:236:52)
    at /Applications/Trilium Notes.app/Contents/Resources/app.asar/src/routes/routes.js:161:44
    at /Applications/Trilium Notes.app/Contents/Resources/app.asar/node_modules/cls-hooked/context.js:118:13
    at Namespace.run (/Applications/Trilium Notes.app/Contents/Resources/app.asar/node_modules/cls-hooked/context.js:97:5)
    at Namespace.runAndReturn (/Applications/Trilium Notes.app/Contents/Resources/app.asar/node_modules/cls-hooked/context.js:117:8)
    at Object.init (/Applications/Trilium Notes.app/Contents/Resources/app.asar/src/services/cls.js:5:22)
16:21:37.854 TypeError: Cannot read properties of undefined (reading 'status')
16:21:37.856 200 GET /api/keyboard-actions with 11940 bytes took 1ms
16:21:37.856 200 GET /api/keyboard-shortcuts-for-notes with 2 bytes took 0ms
16:21:37.864 200 GET /api/script/widgets with 9494 bytes took 0ms
16:21:39.256 304 GET /api/clipper/handshake with 45 bytes took 0ms
16:22:07.045 JS Error: Uncaught error: Message: Uncaught TypeError: Cannot read properties of undefined (reading 'activeNtxId'), URL: http://127.0.0.1:37840/app-dist/desktop.js, Line: 2, Column: 47555, Error object: {}, Stack: TypeError: Cannot read properties of undefined (reading 'activeNtxId')
    at http://127.0.0.1:37840/app-dist/desktop.js:2:47555
    at HTMLDocument.<anonymous> (http://127.0.0.1:37840/app-dist/desktop.js:2:90578)
    at HTMLDocument.handleObj.handler (http://127.0.0.1:37840/libraries/jquery.hotkeys.js:183:30)
    at HTMLDocument.dispatch (http://127.0.0.1:37840/libraries/jquery.min.js:2:43064)
    at HTMLDocument.v.handle (http://127.0.0.1:37840/libraries/jquery.min.js:2:41048)
Stack: Error
    at Object.N [as logError] (http://127.0.0.1:37840/app-dist/desktop.js:2:100894)
    at Hn.window.onerror (http://127.0.0.1:37840/app-dist/desktop.js:2:529664)
16:22:07.119 Generated CSRF token RQSlll7q-5NYrK_vt551c7MzqX82cVqR3bxI with secret undefined
16:22:07.397 200 GET /api/options with 6732 bytes took 1ms
16:22:07.418 ERROR: get /api/tree threw exception: TypeError: Cannot read properties of undefined (reading 'attributeId')
    at getNotesAndBranchesAndAttributes (/Applications/Trilium Notes.app/Contents/Resources/app.asar/src/routes/api/tree.js:101:36)
    at getTree (/Applications/Trilium Notes.app/Contents/Resources/app.asar/src/routes/api/tree.js:144:12)
    at Function.cb (/Applications/Trilium Notes.app/Contents/Resources/app.asar/src/routes/routes.js:159:34)
    at Function.sqliteTransaction (/Applications/Trilium Notes.app/Contents/Resources/app.asar/node_modules/better-sqlite3/lib/methods/transaction.js:65:24)
    at Object.transactional (/Applications/Trilium Notes.app/Contents/Resources/app.asar/src/services/sql.js:236:52)
    at /Applications/Trilium Notes.app/Contents/Resources/app.asar/src/routes/routes.js:161:44
    at /Applications/Trilium Notes.app/Contents/Resources/app.asar/node_modules/cls-hooked/context.js:118:13
    at Namespace.run (/Applications/Trilium Notes.app/Contents/Resources/app.asar/node_modules/cls-hooked/context.js:97:5)
    at Namespace.runAndReturn (/Applications/Trilium Notes.app/Contents/Resources/app.asar/node_modules/cls-hooked/context.js:117:8)
    at Object.init (/Applications/Trilium Notes.app/Contents/Resources/app.asar/src/services/cls.js:5:22)
16:22:07.421 TypeError: Cannot read properties of undefined (reading 'status')
16:22:07.424 200 GET /api/keyboard-actions with 11940 bytes took 1ms
16:22:07.425 200 GET /api/keyboard-shortcuts-for-notes with 2 bytes took 0ms
16:22:07.426 200 GET /api/script/widgets with 9494 bytes took 1ms
16:22:11.438 Generated CSRF token xPMGi1v8-mAvQkRIDMvOzzIw9NbUDZ0cMiac with secret undefined
16:22:11.696 200 GET /api/options with 6732 bytes took 1ms
16:22:11.709 ERROR: get /api/tree threw exception: TypeError: Cannot read properties of undefined (reading 'attributeId')
    at getNotesAndBranchesAndAttributes (/Applications/Trilium Notes.app/Contents/Resources/app.asar/src/routes/api/tree.js:101:36)
    at getTree (/Applications/Trilium Notes.app/Contents/Resources/app.asar/src/routes/api/tree.js:144:12)
    at Function.cb (/Applications/Trilium Notes.app/Contents/Resources/app.asar/src/routes/routes.js:159:34)
    at Function.sqliteTransaction (/Applications/Trilium Notes.app/Contents/Resources/app.asar/node_modules/better-sqlite3/lib/methods/transaction.js:65:24)
    at Object.transactional (/Applications/Trilium Notes.app/Contents/Resources/app.asar/src/services/sql.js:236:52)
    at /Applications/Trilium Notes.app/Contents/Resources/app.asar/src/routes/routes.js:161:44
    at /Applications/Trilium Notes.app/Contents/Resources/app.asar/node_modules/cls-hooked/context.js:118:13
    at Namespace.run (/Applications/Trilium Notes.app/Contents/Resources/app.asar/node_modules/cls-hooked/context.js:97:5)
    at Namespace.runAndReturn (/Applications/Trilium Notes.app/Contents/Resources/app.asar/node_modules/cls-hooked/context.js:117:8)
    at Object.init (/Applications/Trilium Notes.app/Contents/Resources/app.asar/src/services/cls.js:5:22)
16:22:11.709 TypeError: Cannot read properties of undefined (reading 'status')
16:22:11.711 200 GET /api/keyboard-actions with 11940 bytes took 1ms
16:22:11.711 200 GET /api/keyboard-shortcuts-for-notes with 2 bytes took 0ms
16:22:11.712 200 GET /api/script/widgets with 9494 bytes took 0ms
16:22:33.244 Nothing to push
16:22:33.582 Finished pull
16:22:33.583 Nothing to push
16:22:34.505 Slow query took 92ms: SELECT entityName, entityId, hash FROM entity_changes WHERE isSynced = 1 AND entityName != 'note_reordering'
16:22:34.582 Content hash computation took 169ms
16:22:34.585 Content hash checks PASSED
16:22:34.586 Sending message to all clients: {"type":"sync-finished","lastSyncedPush":62760}

zadam added a commit that referenced this issue Aug 26, 2022
@zadam
Copy link
Owner

zadam commented Aug 26, 2022

Thanks, stacktrace helps, even though I don't know what exactly went wrong. You can try 0.54.3, this particular error should go away

@agentydragon
Copy link
Contributor Author

nice, thanks, Trilium loads now. I'll come back if there's more errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants