[OH3] Cannot create a duplicate value 'newState' on expire items

Running 3.0M5, I’m migrating my rules and keep seeing error messages
Cannot create a duplicate value 'newState' in some of my rules.
It’s no generalized error but apparently it happens whenever I sendCommand() or postUpdate() to an ‘expire’ type of item and I believe (not sure) only when I update it to prolongue the timer (i.e. not on timer creation on first access).
Here’s the item the rule chokes upon, it was defined in OH2 as below. I imported that definition into the OH3 GUI.

Switch filename_Nachlauf { expire="30m,command=OFF" }

Anyone an idea ? Sorry for the ‘dev’ category but I 'd think as expire was a very recent addition this is probably more suitable.
BTW @Kai could you please create a ‘migration’ or ‘OH3’ category either in development or in Setup/… ?
All users to migrate (like me) run into errors of some sort related to the difference of OH2 vs OH3 and don’t know where to post them is most appropriate.


2020-12-07 17:13:42.178 [ERROR] [e.automation.internal.RuleEngineImpl] - Failed to execute rule 'filename-4': Fail to execute action: script
2020-12-07 17:13:42.179 [DEBUG] [e.automation.internal.RuleEngineImpl] - The trigger '0' of rule 'filename-4' is triggered.
2020-12-07 17:13:42.179 [DEBUG] [e.automation.internal.RuleEngineImpl] -
java.lang.RuntimeException: Fail to execute action: script
        at org.openhab.core.automation.internal.RuleEngineImpl.executeActions(RuleEngineImpl.java:1187) ~[bundleFile:?]
        at org.openhab.core.automation.internal.RuleEngineImpl.runRule(RuleEngineImpl.java:987) [bundleFile:?]
        at org.openhab.core.automation.internal.TriggerHandlerCallbackImpl$TriggerData.run(TriggerHandlerCallbackImpl.java:90) [bundleFile:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: java.lang.IllegalStateException: Cannot create a duplicate value 'newState'.
        at org.eclipse.xtext.xbase.interpreter.impl.DefaultEvaluationContext.newValue(DefaultEvaluationContext.java:46) ~[?:?]
        at org.openhab.core.model.script.runtime.internal.engine.DSLScriptEngine.createEvaluationContext(DSLScriptEngine.java:149) ~[?:?]
        at org.openhab.core.model.script.runtime.internal.engine.DSLScriptEngine.eval(DSLScriptEngine.java:124) ~[?:?]
        at org.openhab.core.automation.module.script.internal.handler.ScriptActionHandler.lambda$0(ScriptActionHandler.java:62) ~[?:?]
        at java.util.Optional.ifPresent(Optional.java:183) ~[?:?]
        at org.openhab.core.automation.module.script.internal.handler.ScriptActionHandler.execute(ScriptActionHandler.java:59) ~[?:?]
        at org.openhab.core.automation.internal.RuleEngineImpl.executeActions(RuleEngineImpl.java:1179) ~[bundleFile:?]

I think I found it. It was not related to expiry but I had TWO triggers for the same item.
Seems the new rules engine didn’t like that.

EDIT: I also encountered this when I had two different groups and used a trigger

Member of group1 changed
Member of group2 changed

When there was an item to be a member of both groups and it changed, the error surfaced because both conditions apply.
Will file a bug.

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.