Issue with javascript transformation after cleaning cache

I’m using the latest 5.1 Milestone. After cleaning the cache, my javascript transformations are complaining:

Script engine context config:js:profile_ambientlightstatus_from_lux is already closed, this should not happen. Recreating script engine.

I have to remove and reinstall the javascript addon and than the problem is solved. I have no idea how to debug this. Can anybody share some light where to begin?

First of all why are you cleaning the cache? That should only be done after an upgrade (where it’s done automatically) or if you have problems installing add-ons. It’s very disruptive because it forces OH to download and install all the add-ons again.

After clearing the cache, it’s not unusual for the first start of OH to experience all sorts of problems, which is why the recommendation is to let OH come up and settle and then restart. Only then pay attention to errors.

There isn’t enough information here to know what’s going on outside of this general advice.

The issue arised after updating. Couldn’t get it working and after waiting for 2 hours I decided to remove and reinstall the Javascript addon. That fixed the issue. Then I tried to reproduce the issue and found out that cleaning the cache triggered the issue.

It isn’t a regular thing I do, but quite a nuisance to have to do after every update. But probably it is another openHAB quirk I will learn to live with :wink:

When you upgrade or clear the cache, do you let OH settle for a little bit and then restart? That;s the key. Often there are fatal errors during that first start caused by, for example, a JS transformation trying to run before the JS Scripting add-on is reinstalled. So waiting for all the add-ons and then restarting OH will work because in that second boot the JS Scripting add-on will already be installed.