Item cannot be null error

Hey all,

I’ve a problem with syncing one if my notebooks. Here’s the error message:
Error: On file a1c18e993e2040bc8a135496d8c83989.md: Item cannot be null

And here are the contents of the markdown file:

id: a1c18e993e2040bc8a135496d8c83989 parent_id: de5b00c4f5d945c8848830f82f6e90c3 created_time: updated_time: 2019-07-21T07:31:34.091Z is_conflict: latitude: longitude: altitude: author: source_url: is_todo: todo_due: todo_completed: source: source_application: application_data: order: user_created_time: user_updated_time: encryption_cipher_text: JED010000220115a7a6e5887b418f82d04238191de80a0003ba{“iv”:“4BwxKwhXLNK6UcYawJYSyA==”,“v”:1,“iter”:1000,“ks”:128,“ts”:64,“mode”:“ocb2”,“adata”:"",“cipher”:“aes”,“salt”:“tBvMiqC+YtM=”,“ct”:“content ommited”} encryption applied: 1 type : 1type_: 1

It is encrypted and contains simply a link to a resource. It is an embedded picture. I’ve edited and synced this file successfully a few times before. The last edit went wrong.

I find markdown contents are different to all other files. Here’s a working file:

id: 4f85320421724118aaf49140f1e9db40 parent_id: 709d489141cf443782ffb30ae5b304d2 item_type: item_id: item_updated_time: title_diff: body_diff: metadata_diff: encryption_cipher_text: JED010000220115a7a6e5887b418f82d04238191de80a00059e{“iv”:“kZ63OYLsn5Cydh5whSS5VQ==”,“v”:1,“iter”:1000,“ks”:128,“ts”:64,“mode”:“ocb2”,“adata”:"",“cipher”:“aes”,“salt”:“82triVO/VLw=”,“ct”:“content ommited”} encryption_applied: 1 updated_time: 2019-06-30T15:01:23.344Z created time: type : 13

Here’s the log file output right before the error:

2019-07-21 09:53:37: “Sync: finished: Synchronisation finished [1563695616445]”
2019-07-21 09:53:37: "Operations completed: "
2019-07-21 09:53:37: “fetchingTotal: 3”
2019-07-21 09:53:37: “fetchingProcessed: 1”
2019-07-21 09:53:37: “Total folders: 15”
2019-07-21 09:53:37: “Total notes: 37”
2019-07-21 09:53:37: “Total resources: 21”
2019-07-21 09:53:37: “There was some errors:”
2019-07-21 09:53:37: “Error: On file a1c18e993e2040bc8a135496d8c83989.md: Item cannot be null
Error: On file a1c18e993e2040bc8a135496d8c83989.md: Item cannot be null
at Function.itemClass (/usr/share/joplin/resources/app/lib/models/BaseItem.js:100:20)
at Function.unserialize (/usr/share/joplin/resources/app/lib/models/BaseItem.js:399:26)
at loadContent (/usr/share/joplin/resources/app/lib/synchronizer.js:542:30)”
2019-07-21 09:53:37: “Setting up recurrent sync with interval 300”

I sync the files via syncthing to my Android phone where I get the same error.

Version:
image

Thanks!

Did you manually edit the .md file? Because the markdown doesn’t seem to be valid. Maybe copy and paste here exactly as it is and wrap it in a code block to be sure.

id: a1c18e993e2040bc8a135496d8c83989
parent_id: de5b00c4f5d945c8848830f82f6e90c3
created_time:
updated_time: 2019-07-21T07:31:34.091Z
is_conflict:
latitude:
longitude:
altitude:
author:
source_url:
is_todo:
todo_due:
todo_completed:
source:
source_application:
application_data:
order:
user_created_time:
user_updated_time:
encryption_cipher_text: JED010000220115a7a6e5887b418f82d04238191de80a0003ba{"iv":"4BwxKwhXLNK6UcYawJYSyA==","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ocb2","adata":"","cipher":"aes","salt":"tBvMiqC+YtM=","ct":"M+tPQ2E1tF9SHA/4MFENX2ei0wkrcPgwZmQysFetTpMgGPkW8ZDx7Lm/J+q6j/h+vhFWxp4JPox6MXSZM70tUWQbS51r5xWwaTqrbenJVkSVPhQ4OPTd9PeqbPoH3Fqs04tATpwQnWMjNRl1zP9Sk+rFjL084IAKKRvtJdD/AVH/VYhl3m8Xvp7ackoUPwgQ/KhjGceBVuvtQrafALjQ+8xDviy1dF3p5/pNnnPG9qE7CL2pUqeMZLqD41ITIKA+HOQd1Re53EkYsasEaZjQykKuEoSrdvL2tiubtT7bZIiEEc5dw36Whw3tW9h23xXrgWmpt38qsuGmAD80g8fUJx8WAsiSKXxChLsIWNpg7wDxs3Y5BRwrquK4eMVCRJTfamL4Uzy9kYdsCQdNJyp745Ajv/B1KVddzAsC2jqfqdlhoSbtX2OHV1FEeBvyr+STOCyglVolikUymZDEkfvCMSo8ytgvRbY/oxqs7cOq3RDvsuJS1RnbO0u6/9bksqh8ad0blGNd/gfyMxAgUnBYhJLtgkYn26Oeb5ZJDXX6goMcTF4VE8t6U9MlauPzWOLmgm0wH6RIliXo7rKjNM7XrnuqQeelfD1WjDv0+h4FwlsKeqQWCe7S5Tl8bk0O/AVrgaiVDbfVwa7xW5/fa4udQTcrY5NKDh58fDXB28pncfDZMFLZ8zXbrQJsST216VbkGvR9xEOLL4fq7DRz+RvqdiivJphYZX8wBavZgG2WG0KcTom/tyQwvcWtHaGhBH/f5tNIqS2R8rOmoFhqg9IuSa6noG6j4Tl2A6uu+oZGjLFwnuCK"}
encryption_applied: 1
type_: 1type_: 1

Sorry about the messed up snippets from above :slight_smile:
I've edited the file through the Desktop-App and the Android app (no manual edit). I don't exactly remember on which platform I made the edit which broke the file but I think it was Android.

I have hand edited the file to make it match the other working files and the error is gone. I then revesed my changes through my Android phone and the error has reappeared. It looks like the culprit is that the app appends type_: 1 twice at the end of the file. Remove the second appearance and it works.

Today the problem resurfaced. The problem seems to be the Android Version of Joplin. Desktop never had any problem. Here’s the full unedited (broken) file:

id: 79d65ab4c9864da98f5df1b66f813895
parent_id: ca8680e79cb14ed8952ee9b17e4d53ec
created_time:
updated_time: 2019-08-13T17:45:05.506Z
is_conflict:
latitude:
longitude:
altitude:
author:
source_url:
is_todo:
todo_due:
todo_completed:
source:
source_application:
application_data:
order:
user_created_time:
user_updated_time:
encryption_cipher_text: JED010000220115a7a6e5887b418f82d04238191de80a000392{“iv”:“WBk7joRVYGIJFS2jT5Zl8Q==”,“v”:1,“iter”:1000,“ks”:128,“ts”:64,“mode”:“ocb2”,“adata”:"",“cipher”:“aes”,“salt”:“HNoNY8VPLN4=”,“ct”:“cp/1HtHsO/Eocx6dWVo7jGiS6Y/5RKPNJ5ICz4guhh+UgS48rowYLRL5FYqOshtNl2bB/7PWJOgcNMqanzoLlyfLbslXHYyPMgYInuwibR2HvyECJCEsUU7VnTIOf4vHVhZlfds0PtFsm2tbXyj1uQES9YkMlLMO5fwBrQDr/Ru2IfVxEt26OwKfXiFu5y7rGmHO+vDqjNhpK2jCnkcwXOaHeEnAg7N42hWz/a+U1RP5ayi3Ovxanfyz9uvXvKI52byvawFOPuv8BsmY0kgiMVWpWr8oVGak8r1f2tTq/jXLPoAik2Jmw0QjL0GUbO3TyQghHPa+JIqpD/3e9ScbxVC9SJvg6dvksphUWIirNuUXGiyY+mZbOI7Mf+Jl7Eipxm+F2TJ9z68Sx5ldpntZf7YC6DS14u/vrwy0aXZOiICht6q6WXiwVcOi1HN1NZwsSePb4kB0ZFqq84/b5xPajGlVYjdZGU64hY9xKD6Kv66YY73dRKjoXR7+ZxAdPubo7BBpKuywXUyljoqoRe3LVRtZww01JoTRp5QzApUL0G/OeuUofk4eve/xfHBJtDn3w8idfxkL+EnDN4aH39qbcdE0boRp7oU9hMOLizSkRGDL/QwKfonpjbKQoJ0aBJMT95QLYdtGqgW1TFUX4ClFk4wo039XcClr4tGJBvmn+D3IxG5+tdzIJAKLUvGjzqTI83oJMI4kK+g/me/JVMZbyBDW7O+0muOtReaBvbRX7GKmRvAlmU5MVxuxCdr60/hICEhx4lzx”}
encryption_applied: 1
type_: 17tpDdTchq/WOz0pwMbT4EYkapEqsoHrya+KPH/9"}
encryption_applied: 1
type_: 1

After deleting everything after the first occurence of type_: 1 the file worked but some of the contents where lost.

1 Like

I seem to be having the same problem, also using Syncthing (a/k/a its current name, Resilio-Sync :wink: in conjunction with the Android app:

(sorry, I can't find the /code option in the markdown tools??)

2019-11-25 12:00:41: "Operations completed: "
2019-11-25 12:00:41: "fetchingTotal: 4"
2019-11-25 12:00:41: "fetchingProcessed: 3"
2019-11-25 12:00:41: "Total folders: 5"
2019-11-25 12:00:41: "Total notes: 133"
2019-11-25 12:00:41: "Total resources: 207"
2019-11-25 12:00:41: "There was some errors:"
2019-11-25 12:00:41: "Error: On file ef6f9cb65c9840e3adc6e9dc0f5852ce.md: Item c
annot be null
Error: On file ef6f9cb65c9840e3adc6e9dc0f5852ce.md: Item cannot be null
at Function.itemClass (/tmp/.mount_JoplinlECzD2/resources/app/lib/models/Bas
eItem.js:96:20)
at Function.unserialize (/tmp/.mount_JoplinlECzD2/resources/app/lib/models/B
aseItem.js:413:26)
at loadContent (/tmp/.mount_JoplinlECzD2/resources/app/lib/synchronizer.js:6
30:30)"

Can you post the content of ef6f9cb65c9840e3adc6e9dc0f5852ce.md here? It should be somewhere on your sync target.

had to redact a bunch of stuff, hoping I didn’t eliminate any text/formatting that might have been the source of the error(s)

DAILY TO DO

rayfield XXXX


work on XXXX
find XXXX bio

install resilio sync on doze side 

Retia
filing
garbage
XXX

note to XXXXX


before operation:
copy Weininger to thing Kindle?
copy audiobooks!!! to player

rig Joplin on other laptops

 get newspapers?

2019-11-06 09:32
XXXXXX?

work on RP
play with tethering, only to check shit out

Greg & XXXX

XXX

XXX

XXXX

XXXX people 
XXX
XXXX tutorial adding fade ins dissolves, titles
edit video 
write XXXX

artwork for Faile
do that XXX access thing that stupid $35 thing eh
XXXXe

PO
DD
MARISA
MARTHA H

Gail 
https://voxpopulisphere.com/2015/09/27/audio-flannery-oconnor-reads-a-good-man-is-hard-to-find-rare-recording0/?fbclid=IwAR239YbwO-zLOuKkH5cFoKg1j487Gc-x9AOs_4awMv9mavjxxXEEPrZPAYA
Brett's 
https://www.youtube.com/watch?v=6PhedkQsvX8&fbclid=IwAR2eaQND0zjtzD69Y1Ymxo2ejce3wEgmTKAhNU_3I0e_bd81bI_wDElrHlI Quit
 https://vimeo.com/292665390



look at script
YS
weeder please 
take up kraut
	find out how long you can leave it down there as well

XXX

change the conflicted copies dealie with Dropbox, or maybe just stop using it

call XXX

get popel bars

http://www.retiamedical.com/how-it-works/

HOUSE
	cXXXX

check Met HD for dates

find old set lists please 

XXX

fix vim thingie

XXX

write Teddy B

vote SAG

XXXX.com


XXX

buy lXXX

today - submit to more festivals
SELL XXXXXXX

Regina
Regina?

CONSTANTS
	 XXXX

note to 
XXXX

write Al B

archive MGA stuff onto website

XXXXXX

XXXXXtickets
XXXXXX

id: ef6f9cb65c9840e3adc6e9dc0f5852ce
parent_id: f682e6a79362407fae56f34d73e44a2f
created_time: 2019-11-05T16:23:13.286Z
updated_time: 2019-11-25T16:37:39.956Z
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-desktop
source_application: net.cozic.joplin-desktop
application_data: 
order: 0
user_created_time: 2019-11-05T16:23:13.286Z
user_updated_time: 2019-11-25T16:37:39.956Z
encryption_cipher_text: 
encryption_applied: 0
markup_language: 1
type_: 1: 1
type_: 1

At the end it says:

type_: 1: 1
type_: 1

but that’s not valid. It should be just type_: 1. Did you manually edit the file? Or is it Syncthing that can corrupt files like this?

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.