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]: joplin-vscode-plugin search stopped working with recent Joplin 3.1.22+ #108

Open
1 task done
lancelotj opened this issue Nov 7, 2024 · 14 comments
Open
1 task done
Assignees
Labels
bug Something isn't working

Comments

@lancelotj
Copy link

Confirmation

  • I checked FAQ

The tool/kit where the error occurred

joplin-vscode-plugin

Describe the bug

The search function stopped working.

VS Code:
Version: 1.95.1 (user setup)
Commit: 65edc4939843c90c34d61f4ce11704f09d3e5cb6
Date: 2024-10-31T05:14:54.222Z
Electron: 32.2.1
ElectronBuildId: 10427718
Chromium: 128.0.6613.186
Node.js: 20.18.0
V8: 12.8.374.38-electron.0
OS: Windows_NT x64 10.0.19044

Steps to reproduce the behavior

  1. When pressing Ctrl + j, o in VS Code to search, it pops up a warning message: "Cannot read properties of undefined (reading 'path')" and stopped there.
  2. When click search icon button in the Joplin panel in VS Code, it pops up an error message " Error running command joplin.search: Cannot read properties of undefined (reading 'path'). This is likely caused by the extension that contributes joplin.search."

log file

{"level":"error","message":"command error: joplin.search, Cannot read properties of undefined (reading 'path')"}

Additional context

No response

@lancelotj lancelotj added the bug Something isn't working label Nov 7, 2024
@rxliuli
Copy link
Owner

rxliuli commented Nov 8, 2024

I am using v3.1.23 and haven't encountered any issues. Perhaps check the FAQ?


I apologize that the FAQ link is broken; I will update it.

@rxliuli
Copy link
Owner

rxliuli commented Nov 8, 2024

I created a new package; can you install and test it locally? There should be more detailed logs now if an error occurs.

joplin-vscode-plugin-1.7.0.vsix.zip

@lancelotj
Copy link
Author

lancelotj commented Nov 8, 2024

I created a new package; can you install and test it locally? There should be more detailed logs now if an error occurs.

joplin-vscode-plugin-1.7.0.vsix.zip

Installed the provided version, same error in the combinded.log:

{"level":"info","message":"command execute: joplin.search"}
{"level":"error","message":"command error: joplin.search, Cannot read properties of undefined (reading 'path')"}

The other functions seems working well.

@rxliuli
Copy link
Owner

rxliuli commented Nov 8, 2024

The other functions seems working well.

Is only the search function unavailable?

@lancelotj
Copy link
Author

No, just tried list the 20 recent notes with Ctrl + J, O, same error. But read node and save node is working fine.

@rxliuli
Copy link
Owner

rxliuli commented Nov 8, 2024

No, just tried list the 20 recent notes with Ctrl + J, O, same error. But read node and save node is working fine.

I'm sorry, I made a silly mistake. Could you reinstall and check the logs again?

joplin-vscode-plugin-1.7.0.vsix.zip

@lancelotj
Copy link
Author

lancelotj commented Nov 8, 2024

combined.log

{"level":"info","message":"command execute: joplin.search"}
{"level":"error","message":"findParents: folderId not found: 235ae2e867cb47668e1bb81fe0e3d9fa, items: ["2954b7835fc947d49da21631b4b58ca3","d8e2f6eb26c442f090b124d672fc4f30","61dc0cb2f47d46b794c63858b8980d68","55e2aaae7d174305ae8406cd7092ed35","e25513222c7d4efbaee4ca7120a60164","9816057951184065b3f8c0700c9ad4b9","995e497a86324554b1b7a085ecaf10af","495a841ea94147bba8d9ee2c6a5e2e18","f349c14421624e10ba9f1bc0d3d23c95","3aaee011173f4e549147209525691a09","23d04e2a0d984fc795b3622d72e3f706","8310b3d598a6468b9d7db70934ca823f","30d714f90dc34cddbb1075881a7e40c3","32a3f8c7d5e44f479b827903986cfd43","87b0187b66b14b1c8bd6df53c0e683e3","eb9ace8cba904ee484bc8689359e5844","32ec3a0d2503402bb938d7045e2cf5c7","e780ed37d7954fd1b5f019a949f081ab","b5200a6ccb844d639a31216b12f3ef12","ae05f2718f314f749b3a4e3c6caf4376","4126f19ea5a74e4292b0abcd8b329fc4","1ed1fd36e4e04d87b063f6cfc7be4b98","065f357d83364220ace241efe0d0afea","a4652977f37048d4b195c620be215c5b","783d86ed1f3a4e6597a4963f3b8c7540","d32c94f86c5b4063a9635892eb7ad8d2","46136410df3c4cbf88fe53bd250f6067","ebe24ffa6b38490aa40dac349e7ade0e","2a2a4423ad2349b9abac7d95429bad97","46ae0248d1fd469cba6921a430c678ce","6570dd19cf3a43b6a823c5ef03e76c8e","2c740b17cdd24267a23d1cdf83e63837","4901010dda05442c97cc84905cdefa84","d5dc6ccd5cb449788a07224e3ac812b8","ce7ea848221d4a33bcf3c1180b580af5","a9fd44f071524b509551bc484b4cbb84","788b35fd50954535b7a6f49789d16ac9","d8c170f5f1694d818fbed042666c951d","9ee06d3f22514433903248217112b012","3405427ecb2d4efdaae0c2444c41c5ad","929e9bfad73742a3a397c9b711c8a466","4c0cb11e80824fada0d2798bcb43e15a","eb1ef64967094afe99179824260b2d6b","6037b2b488a64cad92fd4975ea5c83b2"]"}
{"level":"error","message":"command error: joplin.search, [object Object]"}

@rxliuli
Copy link
Owner

rxliuli commented Nov 8, 2024

List all directories through the following URL and check if 235ae2e867cb47668e1bb81fe0e3d9fa exists

http://localhost:41184/folders?as_tree&token=***

@lancelotj
Copy link
Author

lancelotj commented Nov 8, 2024

No, does not exist.

@rxliuli
Copy link
Owner

rxliuli commented Nov 8, 2024

Okay, let me add some extra logs. I suspect that the database is corrupted, and some notes have incorrect parent_id.

@rxliuli
Copy link
Owner

rxliuli commented Nov 8, 2024

Please try again; this time the log should contain notes that indicate the cause of the error, in order to confirm whether the database is corrupted, which may need to be reported to Joplin.

joplin-vscode-plugin-1.7.0.vsix.zip


You can run the script below to check all notes.

npm i -g zx
zx scan.js
// scan.js
import { fetch } from 'zx'

const JOPLIN_TOKEN =
  ''

const folderIds = (
  await (
    await fetch(`http://localhost:41184/folders?as_tree&token=${JOPLIN_TOKEN}`)
  ).json()
).items.map((it) => it.id)

const notes = []
for (let i = 1, hasMore = true; hasMore; i++) {
  const u = new URL('http://localhost:41184/notes')
  u.searchParams.set('page', i)
  u.searchParams.set('limit', 100)
  u.searchParams.set('fields', ['id', 'title', 'parent_id'])
  u.searchParams.set('token', JOPLIN_TOKEN)
  const r = await (await fetch(u)).json()
  hasMore = r.has_more
  notes.push(...r.items)
}

const r = notes.filter((it) => !folderIds.includes(it.parent_id))
console.log('error notes', r)

@lancelotj
Copy link
Author

@rxliuli Thanks for your help! This time error log reported the exact note with the wrong parent id. After removing the note from Joplin, everything works as before.

@lancelotj
Copy link
Author

I think it will be better if this extension can handle this kind of error. Joplin can still find the note with wrong parentId without crashing.

@rxliuli
Copy link
Owner

rxliuli commented Nov 8, 2024

I think it will be better if this extension can handle this kind of error. Joplin can still find the note with wrong parentId without crashing.

Yes, I will address this issue later.

@rxliuli rxliuli reopened this Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants