OH3 Config parameter "script" is missing

openHAB 3.1.0~S2171-1 (Build #2171)

When I am trying to create any script using UI, I am getting this error:

**ERROR:HANDLER**  Getting handler 'scriptScriptAction' for module 'script' failed: Config parameter 'script' is missing in the configuration of module 'script'.    

How this can be fixed?
Thanks.

Show the steps you are taking.

Thanks Rich for your reply.
I just found that when script text actually added this error sign changed to “IDLE” and all is working.
So, I just suggest that

**ERROR:HANDLER**  Getting handler 'scriptScriptAction' for module 'script' failed: Config parameter 'script' is missing in the configuration of module 'script'.    

changed to message like “waiting for script”.
Thanks!

I am using the “Release Build” of openHAB 3.1.0 with Zulu Java 11.0.12. (I found out the hard was that Java 16 doesn’t work. I have a fresh install of Ubuntu 20. So, it is clean as a whistle.

I am getting this exact same error. And, only the most rudimentary scripts work. However, they won’t work at all unless I resolve the issue below:

2021-07-29 12:52:57.146 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error while creating ScriptEngine
org.graalvm.polyglot.PolyglotException: Error: Invalid CommonJS root folder: /etc/openhab/automation/lib/javascript/personal

(There is more to that error, but I don’t believe it is relevant)
I create the folder /etc/openhab/automation/lib/javascript/personal then I can run some scripts.

However, if I want to run a script like

itemRegistry.getItem('LocalMoon_MoonPhaseName').getState();

I get the error:

2021-07-29 13:33:00.428 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID '69f7181e4c' failed: org.graalvm.polyglot.PolyglotException: ReferenceError: "itemRegistry" is not defined

It doesn’t matter the item, it doesn’t matter if it is with Blockly or JS. I haven’t been able to get past this. That is why I have a fresh Ubuntu install with nothing but Java and OpenHAB installed. No matter what I do, I cannot script with items. I have seen various posts with errors like mine, but theirs go away, and mine simply do not.

I ran into an error while trying to configure my rules from openhab2 to openhab3.
The old was:

rule "Turn off lights"
    when 
        Time cron "0 0/2 * 1/1 * ? *" //0 0/5 * 1/1 * ? * for 5 minutes
    then
        if (AL_onoff.state == ON){
        if (!zone5.updatedSince(now.minusMinutes((AL_Kitchen_3.state as Number).intValue),"jdbc") && Sw_Kitchen_3.state == ON && !Sw_Kitchen_3.updatedSince(now.minusMinutes((AL_Kitchen_3.state as Number).intValue),"jdbc") ) Sw_Kitchen_3.sendCommand(OFF)
...

And the new is trying to be:

The error is:

And the script inside is:

I also have an issue in the scrip that I can not change the “5” minutes to a variable called AL_Kitchen_3.

Click on the code tab of the rule and paste the contents of that here, using code fences.

```
code goes here
```

Without seeing the code it’s hard to say, but I suspect there is something malformed with the script condition. Keep in mind that the last line of a Script Condition must evaluate to a boolean. No return statements and in all likelihood the if block itself needs to be removed also. See Rules - Blockly | openHAB for more details.

Thanks for the link, with it I managed to get it to work. Below how it should look.
One last thing I need to do is to put that variable in, any hints on that one?

You should be able to just drop the block in to those slots. I don’t use Blockly much but I know you can replace the default blocks as needed.