Is there a way to pinpoint who's doing this error?

  • Platform information:
    • Hardware: i3-530 on docker
    • OS: Lubuntu but using Docker image
    • Java Runtime Environment: The one included in the docker image
    • openHAB version: 3.1.0

Hello everyone,

I migrated to OH3 and I’m having an error during startup. I think the error was present in 2.5 but it’s been so long since I’ve rebooted OH2 that I don’t remember. I’d like to find what is throwing this error.

[WARN ] [ab.core.internal.events.EventHandler] - Creation of event failed, because one of the registered event factories has thrown an exception: Error invoking #valueOf(String) on class ‘org.openhab.core.library.types.DateTimeType’ with value ‘2-01-01T00:00:00.000-0500’.
java.lang.IllegalStateException: Error invoking #valueOf(String) on class ‘org.openhab.core.library.types.DateTimeType’ with value ‘2-01-01T00:00:00.000-0500’.
at org.openhab.core.items.events.ItemEventFactory.parseSimpleClassName(ItemEventFactory.java:190) ~[?:?]
at org.openhab.core.items.events.ItemEventFactory.parseType(ItemEventFactory.java:158) ~[?:?]
at org.openhab.core.items.events.ItemEventFactory.getState(ItemEventFactory.java:136) ~[?:?]
at org.openhab.core.items.events.ItemEventFactory.createStateEvent(ItemEventFactory.java:116) ~[?:?]
at org.openhab.core.items.events.ItemEventFactory.createEventByType(ItemEventFactory.java:80) ~[?:?]
at org.openhab.core.events.AbstractEventFactory.createEvent(AbstractEventFactory.java:53) ~[?:?]
at org.openhab.core.internal.events.EventHandler.createEvent(EventHandler.java:131) ~[?:?]
at org.openhab.core.internal.events.EventHandler.handleEvent(EventHandler.java:106) ~[?:?]
at org.openhab.core.internal.events.EventHandler.handleEvent(EventHandler.java:84) ~[?:?]
at org.openhab.core.internal.events.ThreadedEventHandler.lambda$0(ThreadedEventHandler.java:67) ~[?:?]
at java.lang.Thread.run(Thread.java:829) [?:?]
Caused by: java.lang.reflect.InvocationTargetException
at jdk.internal.reflect.GeneratedMethodAccessor102.invoke(Unknown Source) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.openhab.core.items.events.ItemEventFactory.parseSimpleClassName(ItemEventFactory.java:181) ~[?:?]
… 10 more
Caused by: java.lang.IllegalArgumentException: 2-01-01T00:00:00.000-0500 is not in a valid format.
at org.openhab.core.library.types.DateTimeType.(DateTimeType.java:112) ~[?:?]
at org.openhab.core.library.types.DateTimeType.valueOf(DateTimeType.java:123) ~[?:?]
at jdk.internal.reflect.GeneratedMethodAccessor102.invoke(Unknown Source) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.openhab.core.items.events.ItemEventFactory.parseSimpleClassName(ItemEventFactory.java:181) ~[?:?]
… 10 more
Caused by: java.time.format.DateTimeParseException: Text ‘2-01-01T00T00:00:00:00:00.000-0500’ could not be parsed at index 0
at java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2046) ~[?:?]
at java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1948) ~[?:?]
at java.time.LocalDateTime.parse(LocalDateTime.java:492) ~[?:?]
at org.openhab.core.library.types.DateTimeType.parse(DateTimeType.java:232) ~[?:?]
at org.openhab.core.library.types.DateTimeType.(DateTimeType.java:106) ~[?:?]
at org.openhab.core.library.types.DateTimeType.valueOf(DateTimeType.java:123) ~[?:?]
at jdk.internal.reflect.GeneratedMethodAccessor102.invoke(Unknown Source) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.openhab.core.items.events.ItemEventFactory.parseSimpleClassName(ItemEventFactory.java:181) ~[?:?]

Thank you!

You have a rule somewhere.

In that rule you are creating a DateTimeType with DateTimeType.valueOf().

The String being passed to valueOf is “2-01-01T00:00:00.000-0500” which is not a valid ISO8601 formatted date time string and therefore cannot be parsed and therefore a new DateTimeType cannot be created.

That should give you enough to narrow it down to one or two lines of code in your rules. From there you can figure out where that Sting is coming from and fix the format so it’s a valid ISO8601 format (hint, it’s year-month-day and the year needs to be four digits).

It’s also possible that you have a binding with a String Channel that is linked to a DateTime Item. In that case you need to fix the String returned by the binding (maybe with a transformation?). Again, you probably don’t have that many DateTime Items linked to a binding that will return a String like this so it should be relatively easy to find the one with the problem.

Thanks, that’s a good starting point, I’ll start by removing my rules since it’s pretty easy, it will at least tell me if it’s coming from rules or binding.

Thanks!

Hello,

I found that I have a similar message:

java.lang.IllegalStateException: Error invoking #valueOf(String) on class 'org.openhab.core.library.types.DateTimeType' with value '2-01-01T00:00:00.000-0700'.
	at org.openhab.core.items.events.ItemEventFactory.parseSimpleClassName(ItemEventFactory.java:213) ~[?:?]
	at org.openhab.core.items.events.ItemEventFactory.parseType(ItemEventFactory.java:181) ~[?:?]
	at org.openhab.core.items.events.ItemEventFactory.getState(ItemEventFactory.java:159) ~[?:?]
	at org.openhab.core.items.events.ItemEventFactory.createStateEvent(ItemEventFactory.java:132) ~[?:?]
	at org.openhab.core.items.events.ItemEventFactory.createEventByType(ItemEventFactory.java:84) ~[?:?]
	at org.openhab.core.events.AbstractEventFactory.createEvent(AbstractEventFactory.java:52) ~[?:?]
	at org.openhab.core.internal.events.EventHandler.createEvent(EventHandler.java:141) ~[?:?]
	at org.openhab.core.internal.events.EventHandler.handleEvent(EventHandler.java:116) ~[?:?]
	at org.openhab.core.internal.events.EventHandler.handleEvent(EventHandler.java:94) ~[?:?]
	at org.openhab.core.internal.events.ThreadedEventHandler.lambda$0(ThreadedEventHandler.java:67) ~[?:?]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.reflect.InvocationTargetException
	at jdk.internal.reflect.GeneratedMethodAccessor49.invoke(Unknown Source) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at org.openhab.core.items.events.ItemEventFactory.parseSimpleClassName(ItemEventFactory.java:204) ~[?:?]
	... 10 more
Caused by: java.lang.IllegalArgumentException: 2-01-01T00:00:00.000-0700 is not in a valid format.
	at org.openhab.core.library.types.DateTimeType.<init>(DateTimeType.java:112) ~[?:?]
	at org.openhab.core.library.types.DateTimeType.valueOf(DateTimeType.java:132) ~[?:?]
	at jdk.internal.reflect.GeneratedMethodAccessor49.invoke(Unknown Source) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at org.openhab.core.items.events.ItemEventFactory.parseSimpleClassName(ItemEventFactory.java:204) ~[?:?]
	... 10 more
Caused by: java.time.format.DateTimeParseException: Text '2-01-01T00T00:00:00:00:00.000-0700' could not be parsed at index 0
	at java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2052) ~[?:?]
	at java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1954) ~[?:?]
	at java.time.LocalDateTime.parse(LocalDateTime.java:494) ~[?:?]
	at org.openhab.core.library.types.DateTimeType.parse(DateTimeType.java:241) ~[?:?]
	at org.openhab.core.library.types.DateTimeType.<init>(DateTimeType.java:106) ~[?:?]
	at org.openhab.core.library.types.DateTimeType.valueOf(DateTimeType.java:132) ~[?:?]
	at jdk.internal.reflect.GeneratedMethodAccessor49.invoke(Unknown Source) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at org.openhab.core.items.events.ItemEventFactory.parseSimpleClassName(ItemEventFactory.java:204) ~[?:?]
	... 10 more

I checked my rules and there were none pertaining to a DateTime type.

In the DSC things there is a channel for the Panel that I copied from the docs:

DateTime PANEL_TIME "Panel Time [%1$tA, %1$tm/%1$td/%1$tY %1tT]" <calendar> (DSCAlarmPanel) {channel="dscalarm:panel:MyBridgeName:panel:panel_time"}

Additionally, I have a DateTime Item for each individual zone, linked to the corresponding ZONE_IN_ALARM Channel which then stamps the time when that particular zone is triggered in alarm:

DateTime ZONE1_ALARM_TIME "Main Entry Door Alarm Time [%1$tH:%1$tM:%1$tS  %1$tY.%1$tm.%1$td]" (gDSCAlarmDoor, gDSCAlarmZones) {channel="dscalarm:zone:MyDSC:zone1:zone_in_alarm" [profile="system:timestamp-update"] , stateDescription=" " [pattern="%1$tH:%1$tM:%1$tS  %1$tY.%1$tm.%1$td"]}

I have changed the PANEL_TIME configuration to “%1$tH:%1$tM:%1$tS %1$tY.%1$tm.%1$td” to respect the ISO8601 format, however, the warning remains in logs. I the removed all DateTime Items and there wasn’t any warning. As I tried to reintroduce the Items one by one, the warning reappeared.

Any thoughts on what I should adjust?
Thank you!

Something is updating a DateTime Item with “2-01-01T00:00:00.000-0700”. That’s not a valid ISO8601 date time string and therefore it cannot be parsed.

That might give a clue to where this error is coming from.

Based on the stack trace it looks like it’s coming from processing a state update event. Changing the stateDescription isn’t going to fix that.

Hi Rich,
Thank you for you reply!
The only other thing that comes to mind at this point is the Keypad LCD Message Item which mirrors what I would see on the actual screen. This is linked to the Keypad LCD Status Channel. The output is this:

NOV 01/23 7:51a

I have DSC defined in files as I imported from the DSC binding documents online. I just checked the KEYPAD_LCD_MESSAGE profile and this is the Regex config:

s/00032|Date|Time/ /g

I assume this would have to be changed. Am I on the right track? Thx much!

I’ve no idea. All I know is the error message is specifically complaining about processing a state update event: EventHandler.handleEvent, ItemEventFactory.getState. That it’s failing to parse: ItemEventFactory.parseType. And what it’s failing to parse is indeed a String that cannot be parsed into a DateTimeType: 2-01-01T00:00:00.000-0700. The year, the first number, must be four digits.

Got it! I will go one by one through all the items that have DateTime and figure it out. Thx again!