Is it possible to troubleshoot the (No such file or directory) error?

Often when I reload a rule after editing I get (No such file or directory,) if I then add, and remove a space to the file and save again it usually loads fine. Has anyone ever found a reason for this?
For that matter can anyone tell me how to read the many lines of text it puts into the log?

This sounds like a bug that I thought had been fixed. Apparently not. What version of OH are you using?

Several people have done a lot of elaborate things to work around this problem including:

  • put all your rules into one file
  • create a System started rule that waits long enough for everything to load and then perform a check to see everything loaded. If not then touch the files so they get reloaded again.
  • create an external script that watches OH’s log files and if it sees that error it touches the files so they will be reloaded

I haven’t seen this error in many many months so I’m curious to know if you are on the latest version.

Provide examples.

Openhab V1.8 - I don’t have an example right now as I don’t keep logs between reboots, however on a different note I have the one below that happened after a timer expired. If you can give me a clue where to find the cause from the stack dump I’d be very grateful! I have more than one rule running at that time from different rule files so a start would be which rule has caused it.

2016-04-29 22:15:00.570 [ERROR] [org.quartz.core.JobRunShell ] - Job DEFAULT.2016-04-29T22:15:00.000+12:00: Proxy for org.eclipse.xtext.xbase.lib.Procedures$Procedure0: org.eclipse.xtext.xbase.impl.XClosureImplCustom@67ad56 (explicitSyntax: true) threw an unhandled Exception:
java.lang.RuntimeException: The name ‘’ cannot be resolved to an item or type.
at org.openhab.model.script.interpreter.ScriptInterpreter.internalFeatureCallDispatch(ScriptInterpreter.java:67) ~[na:na]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._evaluateAbstractFeatureCall(XbaseInterpreter.java:658) ~[na:na]
at sun.reflect.GeneratedMethodAccessor41.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_65]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_65]
at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:291) ~[na:na]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:218) ~[na:na]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._evaluateAbstractFeatureCall(XbaseInterpreter.java:657) ~[na:na]
at sun.reflect.GeneratedMethodAccessor41.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_65]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_65]
at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:291) ~[na:na]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:218) ~[na:na]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._evaluateBlockExpression(XbaseInterpreter.java:321) ~[na:na]
at sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_65]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_65]
at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:291) ~[na:na]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:218) ~[na:na]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(XbaseInterpreter.java:204) ~[na:na]
at org.eclipse.xtext.xbase.interpreter.impl.ClosureInvocationHandler.doInvoke(ClosureInvocationHandler.java:46) ~[na:na]
at org.eclipse.xtext.xbase.interpreter.impl.AbstractClosureInvocationHandler.invoke(AbstractClosureInvocationHandler.java:28) ~[na:na]
at com.sun.proxy.$Proxy78.apply(Unknown Source) ~[na:na]
at org.openhab.model.script.internal.actions.TimerExecutionJob.execute(TimerExecutionJob.java:44) ~[na:na]
at org.quartz.core.JobRunShell.run(JobRunShell.java:213) ~[quartz-all-2.1.7.jar:na]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557) [quartz-all-2.1.7.jar:na]
2016-04-29 22:15:00.585 [ERROR] [org.quartz.core.ErrorLogger ] - Job (DEFAULT.2016-04-29T22:15:00.000+12:00: Proxy for org.eclipse.xtext.xbase.lib.Procedures$Procedure0: org.eclipse.xtext.xbase.impl.XClosureImplCustom@67ad56 (explicitSyntax: true) threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception.
at org.quartz.core.JobRunShell.run(JobRunShell.java:224) ~[quartz-all-2.1.7.jar:na]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557) [quartz-all-2.1.7.jar:na]
Caused by: java.lang.RuntimeException: The name ‘’ cannot be resolved to an item or type.
at org.openhab.model.script.interpreter.ScriptInterpreter.internalFeatureCallDispatch(ScriptInterpreter.java:67) ~[na:na]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._evaluateAbstractFeatureCall(XbaseInterpreter.java:658) ~[na:na]
at sun.reflect.GeneratedMethodAccessor41.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_65]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_65]
at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:291) ~[na:na]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:218) ~[na:na]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._evaluateAbstractFeatureCall(XbaseInterpreter.java:657) ~[na:na]
at sun.reflect.GeneratedMethodAccessor41.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_65]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_65]
at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:291) ~[na:na]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:218) ~[na:na]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._evaluateBlockExpression(XbaseInterpreter.java:321) ~[na:na]
at sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_65]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_65]
at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:291) ~[na:na]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:218) ~[na:na]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(XbaseInterpreter.java:204) ~[na:na]
at org.eclipse.xtext.xbase.interpreter.impl.ClosureInvocationHandler.doInvoke(ClosureInvocationHandler.java:46) ~[na:na]
at org.eclipse.xtext.xbase.interpreter.impl.AbstractClosureInvocationHandler.invoke(AbstractClosureInvocationHandler.java:28) ~[na:na]
at com.sun.proxy.$Proxy78.apply(Unknown Source) ~[na:na]
at org.openhab.model.script.internal.actions.TimerExecutionJob.execute(TimerExecutionJob.java:44) ~[na:na]
at org.quartz.core.JobRunShell.run(JobRunShell.java:213) ~[quartz-all-2.1.7.jar:na]
… 1 common frames omitted

First, it helps to put logs as well as code in a code block so we can see the log statements all on one line. Wrap them in backticks:

```
log files
```

The first couple of lines of an exception stack trace is pretty much the only thing that will have any information you may care about. The rest is great for the developers of the code but usually don’t tell you the user much of anything at all.

In this case the “text” part of the error message says: “(explicitSyntax: true) threw an unhandled Exception” which tells me that there was a problem in one of your rules that caused an exception to be thrown. This doesn’t narrow things down much unfortunately. The next line is helpful though: “The name ‘’ cannot be resolved to an item or type.” That tells me you have a syntax error somewhere in your rules file. It is looking for an Item or a variable named " which obviously makes no sense. I’m going to guess you have a missmatched paren, bracket, curly bracket, or quote.

I highly recommend using Designer as it will catch this sort of error for you as you type.

Would a timer expiring throw the “(explicitSyntax: true)” part or is it the next item in line that is coming up with that?

This is a syntax error and has nothing to do with timers or code logic.

Thanks, is it likely to be a rule that was directly triggered at that time or do I need to look at rules that are triggered by other rules? For example, if a timer sets a switch called “Night” in a rule called “set night time”, is it likely to be the “set night time” rule that’s at fault, or could it be anything that responds to the switch “Night” changing as well?

I use designer for all of my stuff so its not an error that its picked up

I’m not sure then. Somehow it is expecting you to have an Item named " which points to a missmatched delimiter. But Designer would be throwing up all over the place if it were.

I’m not sure what it could be.

Thanks for the pointers, I’ll add logging after each timer with different wording so I can identify which rule is upset, and from there I can slowly find it.
Around 6 different things hang off the variable bedtime, and as many of them are in the form of bedtime minus calculated time to do something I can’t simply have a bedtime item that everything responds to.
Knowing its just a syntax error is a start.
As a general rule can you see anything wrong with the following just to confirm I’m not doing anything obviously wrong?

rule "HVAC Bedtime Off Scheduler"
when Time cron "45 5 0 ? * *"
or System started
or Item TodayBedTime changed
then
if (HVACEveningOffTime!=null) {	HVACEveningOffTime.cancel	}
if (DisableScheduler.state == OFF)	{
	var year   = now.getYear
	var month  = now.getMonthOfYear
	var day    = now.getDayOfMonth
	var DateTime TodaysEveningOffTime = parse(year+"-"+month+"-"+day+"T"+TodayBedTime.state.toString+":00")
	if (TodaysEveningOffTime.beforeNow) {	}	else	{
		logInfo("Heating", "Heating Evening Off Scheduled for " +TodaysEveningOffTime)
		HVACEveningOffTime = createTimer(TodaysEveningOffTime.minusMinutes(10)) [|
			logInfo("Heating", "Heating Evening Scheduled Off Rule Ran")
			sendCommand(HVAC, OFF)
                        if (MyItem.state == OFF && SomeOtherItem.state == ON)
                           logInfo("Heating", "My Item was sent an ON command"
                           sendCommand(MyItem, ON)
			]
	}
}
end

Some things are a bit awkward (e.g. and empty if with a populated else) but I see nothing obviously wrong.

1 Like