Editor Problem: is either empty or cannot be parsed correctly


to edit my files (*.rules,…) i try
nano (via ssh)
Notepad++ (via smb)
VisualStudio Code (via smb)

if i use Notepad++ or VSC i get this error in my OH.log

is either empty or cannot be parsed correctly

code is the same!


There could be small differences that the editors “hide” from you. To see if there are any differences you could try

$ diff <file1> <file2> 

the files are the same.
i edit this with notepad++ --> error
if i open the same file with nano, change nothing, press only strg+o to save, i get no error

Forgive me if I sound patronizing, but have you run diff to rule out any differences?

The error appears usually only when editing files via samba. openHAB tries to read the file while it is not yet saved completely, therefore the error message.
Shortly after that you will see “xxxx.file loaded”, so nothing to worry about.
If you edit the file locally via nano or any other local editor, you won’t have that error message.

Yes, I get the same error using Samba and there is another topic where the same explanation is given - several users also affected there.

Given the prevalence of this issue and considering that this happens even with a standard setup that is delivered with openHABian, shouldn’t openHAB be adjusted maybe to put a delay (e.g. 3 seconds) before trying to load and validate updated rule files?