"Cannot coerce value '-1' into type..." Error Message

I get this error message “ClassCastException: Cannot coerce value ‘-1’ into type: interface com.inductiveautomation.ignition.common.Dataset” the first time I open a window in my project. All of my windows have the same Background Color, so I have that bound to a tag, that way I can change the Background Color for all windows easily.

Any update on this? I am getting a very similar error the first time I open a specific window in Designer. This error only occurs the first time I open this window. If I want to recreate the error I have to close out Ignition and open the window again. I have a ‘lookup’ call as part of an expression and that is how I am using the dataset. The exact error I am getting is:

java.lang.Exception: Error executing expression binding on
mappingPLC_to_HMI.mappingPLC_to_HMI.Group 2.IsolatedBoolean 28.BooleanLabel
	at com.inductiveautomation.factorypmi.application.binding.ExpressionPropertyAdapter.runExpression(ExpressionPropertyAdapter.java:91)
	at com.inductiveautomation.factorypmi.application.binding.ExpressionPropertyAdapter.startup(ExpressionPropertyAdapter.java:112)
	at com.inductiveautomation.factorypmi.application.binding.DefaultInteractionController.startupAdapters(DefaultInteractionController.java:313)
	at com.inductiveautomation.factorypmi.application.components.template.VisionTemplate.startup(VisionTemplate.java:174)
	at com.inductiveautomation.factorypmi.application.components.template.TemplateHolder.startupTemplate(TemplateHolder.java:398)
	at com.inductiveautomation.factorypmi.application.components.template.TemplateHolder.onStartup(TemplateHolder.java:505)
	at com.inductiveautomation.vision.api.client.components.model.AbstractVisionPanel.startupComponent(AbstractVisionPanel.java:207)
	at com.inductiveautomation.factorypmi.application.components.util.ComponentVisitor$StartupVisitor.visit(ComponentVisitor.java:300)
	at com.inductiveautomation.factorypmi.application.components.util.ComponentVisitor.walk(ComponentVisitor.java:77)
	at com.inductiveautomation.factorypmi.application.components.util.ComponentVisitor.walk(ComponentVisitor.java:74)
	at com.inductiveautomation.factorypmi.application.components.util.ComponentVisitor.walk(ComponentVisitor.java:57)
	at com.inductiveautomation.factorypmi.application.FPMIWindow.startup(FPMIWindow.java:343)
	at com.inductiveautomation.factorypmi.designer.workspace.WindowWorkspace$DesigntimeWindowOpener.openWindow(WindowWorkspace.java:3553)
	at com.inductiveautomation.factorypmi.designer.workspace.WindowWorkspace.openWindow(WindowWorkspace.java:1318)
	at com.inductiveautomation.factorypmi.designer.workspace.StartupPanel$ResourceThumbnail.onClick(StartupPanel.java:335)
	at com.inductiveautomation.factorypmi.designer.workspace.StartupPanel$ThumbnailButton$1.mouseClicked(StartupPanel.java:242)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.awt.EventQueue.access$500(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: com.inductiveautomation.ignition.common.expressions.ExpressionException: Tag 'std_styleTags/mappingBitsPLC_to_HMI' value cannot be coerced into a Dataset
	at com.inductiveautomation.ignition.common.expressions.BoundTagExpression.execute(BoundTagExpression.java:45)
	at com.inductiveautomation.ignition.common.expressions.DefaultFunctionFactory$LookupFunction.execute(DefaultFunctionFactory.java:2413)
	at com.inductiveautomation.ignition.common.expressions.FunctionExpression.execute(FunctionExpression.java:69)
	at com.inductiveautomation.factorypmi.application.binding.ExpressionPropertyAdapter.runExpression(ExpressionPropertyAdapter.java:82)
	... 46 more
Caused by: java.lang.ClassCastException: Cannot coerce value '-1' into type: interface com.inductiveautomation.ignition.common.Dataset
	at com.inductiveautomation.ignition.common.TypeUtilities.coerce(TypeUtilities.java:1279)
	at com.inductiveautomation.ignition.common.TypeUtilities.coerceNullSafe(TypeUtilities.java:752)
	at com.inductiveautomation.ignition.common.expressions.BoundTagExpression.execute(BoundTagExpression.java:41)
	... 49 more

Reddwerks v7.8.1 (b2016021709)
Java: Oracle Corporation 1.8.0_121

I don’t get any errors like this when I open up the client.

I would also like to add that I am using this expression 31 times and every object throws the same error twice for a total of 62 errors.

If these errors are the result of a binding not having a value immediately upon opening the window you could wrap the binding in a try function in an expression. That way you could provide an innocuous value as a default.

JGJohnson,

Thanks for the suggestion! I did that and it eliminated my errors. I had another thought to try and move this dataset to a client tag and perform the lookup on that client tag. This also worked! So what I am thinking is happening is that in Designer this dataset tag isn’t available when the window opens the first time. This might explain why the error only occurs the first time the window is opened in the designer. Not sure why the client doesn’t have these errors though.

I sincerely appreciate your help. I am hoping that IA will show up here and give an explanation of what is happening so I can have a better understanding when I do this design.

It’s also worth noting that I didn’t think this error was occurring in my client. Well I checked the diagnostic window and the error also occurs in the client if I don’t use either a client tag or a try statement. The errors just aren’t creating a pop up window like they do in the designer. Here is the code I am using to bind a string to a template property:

lookup({std_styleTags/mappingBitsPLC_to_HMI},
	{mappingPLC_to_HMI.Group 2.IsolatedBoolean.BitLocation},
	"null",
	"PLC_stsBit",
	"stsName")

“{std_styleTags/mappingBitsPLC_to_HMI}” is the tag that I am replacing with a client version that also eliminates these errors.

I’m getting a very similar error, but I notice on your console output, it gives a tag name, mine console is not giving the tag name, any clues where to start looking?


16:42:08.125 [AWT-EventQueue-2] ERROR com.inductiveautomation.factorypmi.application.binding.AbstractPropertyAdapter - null
java.lang.ClassCastException: Value -9223372036854775808 can not be coerced to integer due to overflow.
at com.inductiveautomation.ignition.common.TypeUtilities.coerce(TypeUtilities.java:905)
at com.inductiveautomation.factorypmi.application.binding.AbstractPropertyAdapter.setQValue(AbstractPropertyAdapter.java:222)
at com.inductiveautomation.factorypmi.application.binding.AbstractPropertyAdapter.updateValue(AbstractPropertyAdapter.java:262)
at com.inductiveautomation.factorypmi.application.binding.ExpressionPropertyAdapter.runExpression(ExpressionPropertyAdapter.java:88)
at com.inductiveautomation.factorypmi.application.binding.ExpressionPropertyAdapter.startup(ExpressionPropertyAdapter.java:112)
at com.inductiveautomation.factorypmi.application.binding.DefaultInteractionController.startupAdapters(DefaultInteractionController.java:332)
at com.inductiveautomation.factorypmi.application.components.template.VisionTemplate.startup(VisionTemplate.java:177)
at com.inductiveautomation.factorypmi.application.components.template.TemplateHolder.startupTemplate(TemplateHolder.java:401)
at com.inductiveautomation.factorypmi.application.components.template.TemplateHolder.onStartup(TemplateHolder.java:509)
at com.inductiveautomation.vision.api.client.components.model.AbstractVisionPanel.startupComponent(AbstractVisionPanel.java:207)
at com.inductiveautomation.factorypmi.application.components.util.ComponentVisitor$StartupVisitor.visit(ComponentVisitor.java:302)
at com.inductiveautomation.factorypmi.application.components.util.ComponentVisitor.walk(ComponentVisitor.java:79)
at com.inductiveautomation.factorypmi.application.components.template.VisionTemplate.startup(VisionTemplate.java:181)
at com.inductiveautomation.factorypmi.application.components.template.TemplateHolder.startupTemplate(TemplateHolder.java:401)
at com.inductiveautomation.factorypmi.application.components.template.TemplateHolder.onStartup(TemplateHolder.java:509)
at com.inductiveautomation.vision.api.client.components.model.AbstractVisionPanel.startupComponent(AbstractVisionPanel.java:207)
at com.inductiveautomation.factorypmi.application.components.util.ComponentVisitor$StartupVisitor.visit(ComponentVisitor.java:302)
at com.inductiveautomation.factorypmi.application.components.util.ComponentVisitor.walk(ComponentVisitor.java:79)
at com.inductiveautomation.factorypmi.application.components.util.ComponentVisitor.walk(ComponentVisitor.java:59)
at com.inductiveautomation.factorypmi.application.FPMIWindow.startup(FPMIWindow.java:349)
at com.inductiveautomation.factorypmi.designer.workspace.WindowWorkspace$DesigntimeWindowOpener.openWindow(WindowWorkspace.java:3573)
at com.inductiveautomation.factorypmi.designer.workspace.WindowWorkspace.openWindow(WindowWorkspace.java:1333)
at com.inductiveautomation.factorypmi.designer.model.navtree.WindowNode.onDoubleClick(WindowNode.java:264)
at com.inductiveautomation.ignition.designer.navtree.NavTreePanel$MouseListener$1.run(NavTreePanel.java:649)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
16:42:10.932 [AWT-EventQueue-2] ERROR com.inductiveautomation.factorypmi.application.binding.AbstractPropertyAdapter - null
java.lang.ClassCastException: Value -9223372036854775808 can not be coerced to integer due to overflow.
at com.inductiveautomation.ignition.common.TypeUtilities.coerce(TypeUtilities.java:905)
at com.inductiveautomation.factorypmi.application.binding.AbstractPropertyAdapter.setQValue(AbstractPropertyAdapter.java:222)
at com.inductiveautomation.factorypmi.application.binding.AbstractPropertyAdapter.updateValue(AbstractPropertyAdapter.java:262)
at com.inductiveautomation.factorypmi.application.binding.ExpressionPropertyAdapter.runExpression(ExpressionPropertyAdapter.java:88)
at com.inductiveautomation.factorypmi.application.binding.ExpressionPropertyAdapter$1.run(ExpressionPropertyAdapter.java:58)
at com.inductiveautomation.ignition.client.util.EDTUtil$ProcessQueue.run(EDTUtil.java:113)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Hi KRoberts,

See this line in your stack trace: “Value -9223372036854775808 can not be coerced to integer due to overflow.”

That number is too small to be converted to a Java integer so you get that error.

The minimum size for a Java integer is -2,147,483,648.

Perhaps bind to a Long property instead of an Integer property.

Best,

I see the error, just wondering if there is a way to determine which tag or control is throwing the error. The console output doesn’t show the root, just the error. I noticed on the previous reply where the console output specified the tag that was the cause.

KRoberts,
Based on the stack trace; specifically these lines:

at com.inductiveautomation.factorypmi.application.binding.ExpressionPropertyAdapter.startup(ExpressionPropertyAdapter.java:112) at com.inductiveautomation.factorypmi.application.binding.DefaultInteractionController.startupAdapters(DefaultInteractionController.java:332) at com.inductiveautomation.factorypmi.application.components.template.VisionTemplate.startup(VisionTemplate.java:177) at com.inductiveautomation.factorypmi.application.components.template.TemplateHolder.startupTemplate(TemplateHolder.java:401) at com.inductiveautomation.factorypmi.application.components.template.TemplateHolder.onStartup(TemplateHolder.java:509)

I would say to look for a template repeater or template canvas that either has a custom property with an expression binding, or contains templates with expression properties.

Jeffkrol,
Probably the issue is that these expression bindings are firing before the client has created all the subscriptions necessary; so it’s using a default value for the properties. The try() function is a perfectly valid solution to this issue.

1 Like

Make a copy of the window that has the error. Then close all other windows. Then start deleting components on your window until your error goes away. The binding error is on the component that you delete that causes the error to stop happening.

Best,