Problem:Skipping unreadable file while building cache

I got a problem while using org-roam in my wsl2 emacs, when I type "M-x org-roam-db-build-cache ",I got a Warning info:

Warning (org-roam): Skipping unreadable file while building cache: /mnt/f/testroam/

It seems that the db is not update correctly after I change my org file,what’s the problem?
And I run “M-x org-roam-find-file”,but on file can be found.
My emacs Environment:

  • Emacs: GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20)
    of 2020-09-15
  • Framework: N/A
  • Org: Org mode version 9.3 (release_9.3 @ /usr/share/emacs/27.1/lisp/org/)
  • Org-roam: 1.2.3

What’s in the file?
I have a similar set up (WSL2, but org-roam-directory being symlink pointing to an iCloud folder on the Windows side); I have no problem.

The warning says Emacs/Org-roam cannot read the file. So I would guess something is not right in the file. Can you open it from normal Emacs, or from your shell (bash, I guess?)?

In addition, I suspect you would have a dedicated buffer called “*Warning*” that lists what went wrong when Org-roam was reading your files to update the DB – e.g. failed to parse aliases, etc. Try to see if you have a Warning buffer and see if you can find out the cause of your DB update problem.

This is a strange porblem,I check message when I start up emacs,there is no any other Error message about org-roam:

(org-roam) Processed 0/1 modified files...
(org-roam) total: Δ0, files-modified: Δ1, ids: Δ0, links: Δ0, tags: Δ0, titles: Δ0, refs: Δ0, deleted: Δ0

Then the warnning buffer show out that the file is unreadable

Warning (org-roam): Skipping unreadable file while building cache: /mnt/f/testroam/

And I can open the file in the emacs,only three line :

#+title: test
this is a test

Then I Guess if the file attribute problem, but it is not:

-rwxrwxrwx 1 jacklisp jacklisp 45 Jan  4 10:27

Then I go and track If the sqlite3 works normal, It is normal in my machine since I can use sqlite3
My Emacs configuration featrue is :

Its value is

I compile it without json support.

I think #+roam_alias cannot be without values. Delete the keyword, or add a value to it.

I delete this line but the problem still remain.

True. Can’t reproduce the problem.
I use Org Mode 9.4.4 (same Emacs 27.1).
Perhaps update Org Mode and Org-roam both?
I would have no other ideas why you get this.

I would try toggle-debug-on-error, and if that does not tell you why, then edebug to see if I can get to the bottom of it… There are only two locations ins org-roam-db.el where that message is written.

Sorry, alternatively… Is it possible that you modified the file on the Windows side, and the line feed or carriage return character are not compatible between the two systems?? I am stubbing in the dark, so disregard this if you know this is no issue.

Are you creating and changing the same file on both side of the systems (create in Win and change in Linux,etc.?). I stick to one OS for the same file. That could be a factor…

The directory I created is empty, and I use org-roam-find-file to create the test file.
I have trying to delete the elc and recompile the org-roam package but the problem still there.
I have to use debugger to see what is going on in the org-roam-db.el,thanks for your help!

The problem is locate in the org-roam-db.el

(condition-case nil
            (org-roam--with-temp-buffer file
              (setq modified-count (1+ modified-count))
              (setq link-count (+ link-count (org-roam-db--insert-links)))
              (setq tag-count (+ tag-count (org-roam-db--insert-tags)))
              (setq title-count (+ title-count (org-roam-db--insert-titles)))
              (setq ref-count (+ ref-count (org-roam-db--insert-refs))))

when the function org-roam-db–insert-links will cause a file-error
after comment this line, change to

(condition-case nil
            (org-roam--with-temp-buffer file
              (setq modified-count (1+ modified-count))
              ;; (setq link-count (+ link-count (org-roam-db--insert-links)))
              (setq tag-count (+ tag-count (org-roam-db--insert-tags)))
              (setq title-count (+ title-count (org-roam-db--insert-titles)))
              (setq ref-count (+ ref-count (org-roam-db--insert-refs))))

the db can be update normally by “M-x org-roam-db-build-cache”
I just wanna catch what does org-roam-db–insert-links function do in the programme?
And comment this line will cause no backlinks show in the buffer.

I don’t know; I am not a developer of this package. You could look further inside that function, but it sounds like a defect in the function. You might like to report it in the project’s GitHub repo.

By the looks of the function’s name, I guess it looks at the file (current buffer, I think), and tries to extract links.

Perhaps if there is no file with a link, it does not handle it properly, and gives you an unnecessary error. If I hadn’t had any other file, perhaps I would have gotten the same error.

I just tried my own theory… I still cannot reproduce the error. I changed org-roam-directory to make the db empty (initialized, so empty db file), and then added the test file… I do not have the error.

Maybe I need to try with -Q option.

what is your org version?

9.4.4 ( that was in my previous suggestions yesterday, but sorry, probably buried in other comments).

I can’t repro, with even -Q option

It’s not shown, but I installed org-roam from MELPA.

Maybe my org version is too low (9.3), I trying to ungrade my org version to 9.4.4 and check again, thanks for help

Finally, I downgrade the org-roam package to org-roam-20201001.430,that package solve the problem, thinks a lot!
at a glance,the method is difference compare with org-roam-1.2.3

(when-let (links (org-roam--extract-links file))
                [:insert :into links
                 :values $v1]
               (setq link-count (1+ link-count)))

you should extract the link first,than insert the link, if there is no link ,do nothing.

How ever, according to this

I cann’t reproduce the problem, obviously, org-roam-1.2.3 is affected by the other packages of mine emacs, some package is too old.