Home / GitHub Page

Item cannot be null error

I don’t believe I did, at least until the error appeared: I think I removed a line near the very top because I thought it might have been the source of the Joplin error, but it’s highly unlikely I would have added that line.

  1. The Android version of ResilioSync – that’s what Syncthing is called now – seems to me not as reliable as the Linux or Windows versions: for instance, I believe I have to go into the app to get it to perform a sync. While I have only been using it for several weeks – likewise, I am also very new to Joplin – I haven’t experienced any issues, apart from this

Don’t know if it’s pertinent, but I have seen conflicts arise thanks to my multiple backup strategies: DropBox as well as pCloud, though usually these create copies with filenames containing [conflicted]. Possibly a problem created by edited the same file in different sessions?

Can I just remove the line containing “type_: 1: 1” and proceed?

Yes but make sure there’s no newline after it.

The way your file looks now is as if something had overwritten the file, but left the previous content at the end. Not sure if it’s syncthing but I’d be careful and try to find the cause, if you don’t want to lose your data.

1 Like

Deleting that line seemed to fix things for a while, but I’m having numerous other problems trying to get the Android version running with Resilio Sync – I suspect it’s essentially this issue

The Linux versions sync well with Resilio Sync – for those of us trying to get away from commercial services, Resilio (which used to be called Syncthing) is a great solution, it uses BitTorrent to sync directories.

This morning I tried to see if I could get Joplin/Android working with Dropbox, but failed, unfortunately. If there is a recommended way to get this working, I’d be happy to try it.

Fyi syncthing is a separate service and not related to resilio, resilio was previously called bittorent sync and before that it was just called SyncApp

I’ve been having the same issue. I’m using syncthing between joplin on android and linux. The problem is on the android side. I think syncthing and joplin are trying to write to the same file at once. I’m doing some further testing.

I am also having the same issue. I am using Syncthing and Joplin on Android. I really like Joplin so far, but this bug makes it hard to be completely confident that my data will stay intact.

Edit: I have searched Syncthing’s issues and forum and no one seems to have mentioned this over there. I would try create a post, but not sure I can gather enough info to make a meaningful bug report.

Edit2: After thinking about what @laurent said about leaving previous content at the end, I tried making a simple note in Joplin and then deleting a line to make the note shorter. This immediately triggered the problem.

Test syncthing and joplin

This is a note to test what is corrupting my notes.

1




id: e393a5186da742899147eb516d0c3ddd
parent_id: 132f72eb544549378dc8f7222e47fef8
created_time: 2019-12-05T13:46:36.923Z
updated_time: 2019-12-05T13:47:30.865Z
is_conflict: 0
latitude: 0.00000000
longitude: 0.00000000
altitude: 0.0000
author: 
source_url: 
is_todo: 0
todo_due: 0
todo_completed: 0
source: joplin
source_application: net.cozic.joplin-mobile
application_data: 
order: 0
user_created_time: 2019-12-05T13:46:36.923Z
user_updated_time: 2019-12-05T13:47:30.865Z
encryption_cipher_text: 
encryption_applied: 0
markup_language: 1
type_: 1: 1

Joplin writes the complete content to the file then closes it. If Syncthings keeps open handles on file and doesn’t watch them for changes this could happen.

It would probably be worth reporting this on Syncthing forum as it’s unlikely we can do something on our side.

1 Like

@laurent, Thanks for your replies. I have started a thread in the syncthing forum and one of the syncthing maintainers has responded. I will try do my part to go between as needed, but I am not certain I can answer the questions accurately.

What does “Synchronize” in Joplin do, precisely?

One important point is that Joplin has been used with many sync clients, such as Dropbox, OneDrive, Nextcloud and many others for several years, and this particular issue only happens with Syncthing. I’m mentioning this because it would be easy to assume Joplin writes to the files in a strange way, but it’s not like this, or it would happen with all the other backends too.

Syncthing triggers when android announces that a file has been changed. Then it syncs it with the other devices. Does anyone know how android handles file updates? Does it announce when a edited file is closed or when data is written to a file? Because the issue only happens on an android device.

@laurent, do you mind if I copy and paste some of your response over to the syncthing forum?

(from calmh, a syncthing maintainer)

When Syncthing writes to a file it first writes it out to a temporary file, all the while verifying the checksum of the data. It then moves that temp file in place over the old file. It doesn’t write in place, but what looks like it has happened here is that something has written a slightly smaller note on top of a larger one, leaving the old extra data in place at the end. I don’t know what would cause that but I have a hard time imagining Syncthing doing it.

Yes sure

This seems to not actually be related to syncthing.

I tested this on my old phone (a Pixel XL running Android 10). I uninstalled syncthing completely and changed the Joplin local sync folder to a new folder in the phone storage.

I can still cause the problem by doing the following:

  1. Create a new note with several lines.
  2. Hit Synchronize in Joplin. Returns just fine.
  3. Delete a line from the note.
  4. Hit Synchronize again.

For me, this will bring up the “Item cannot be null error”. @lerker100, is there any chance you can try something like this?

I had the same thing happen. When following your steps. I also have a pixel running Android 10

I just tested it on Linux and it works just fine. So it’s only on the app.

Any chance this is an Android 10 issue? Maybe it’s neither Joplin’s nor Syncthing’s fault. A few things stopped working when my Pixel was updated to Android 10. Just an idea…

Hmm, ok so it might be unrelated to syncthing then, but something to do with a recent version of Android. Please could you all confirm which version of Android you’re using?

I’m using Android 10 build QP1A.191005.007.A1