Cannot Query Tag Data With queryTagHistory

Hello,

I am trying to query tag history from a tag in an Ignition script and keep receiving the following error:

Bounds of result set does not match that of value set. (0 in vs 1 expected)

Here is the code I am using:

# This part works fine:
path = ["[default]PCS/Gen1_Running"]
findTag = system.tag.readBlocking(path)
print findTag[0]
# This is where the error occurs:
endTime = system.date.now()
startTime = system.date.addHours(endTime, -24)
tagHistory = system.tag.queryTagHistory(path, startTime, endTime)

I have tried every variation of the queryTagHistory function to no avail. Tried with many other tag paths, and confirmed they all have history enabled. In fact I can view their history in Powerchart trends just fine.

Does anyone have any advice or suggestions on what else I can try? Am I missing anything?

No idea what is behind that link so I am not clicking it, but try it with fully filled out parameters


returnDataSet = system.tag.queryTagHistory(paths=path, startDate=startTime, endDate=endTime,  aggregationMode="LastValue",intervalSeconds=1, returnFormat='Wide')

Just this stack trace:

Java Traceback:
Traceback (most recent call last):
  File "<input>", line 28, in <module>
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:360)
 
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:334)
 
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.runTagHistoryQuery(GatewayInterface.java:802)
 
	at com.inductiveautomation.ignition.client.script.ClientTagUtilities.queryTagHistoryImpl(ClientTagUtilities.java:342)
 
	at com.inductiveautomation.ignition.common.script.builtin.AbstractTagUtilities.queryTagHistory(AbstractTagUtilities.java:731)
 
	at jdk.internal.reflect.GeneratedMethodAccessor108.invoke(Unknown Source)
 
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
 
com.inductiveautomation.ignition.client.gateway_interface.GatewayException: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Bounds of result set does not match that of value set. (0 in vs 1 expected)
 
 
	at org.python.core.Py.JavaError(Py.java:547)
 
	at org.python.core.Py.JavaError(Py.java:538)
 
	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:192)
 
	at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction.__call__(ScriptManager.java:552)
 
	at org.python.core.PyObject.__call__(PyObject.java:400)
 
	at org.python.pycode._pyx237.f$0(<input>:30)
 
	at org.python.pycode._pyx237.call_function(<input>)
 
	at org.python.core.PyTableCode.call(PyTableCode.java:173)
 
	at org.python.core.PyCode.call(PyCode.java:18)
 
	at org.python.core.Py.runCode(Py.java:1687)
 
	at org.python.core.Py.exec(Py.java:1731)
 
	at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:277)
 
	at org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter.java:130)
 
	at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleWorker.doInBackground(JythonConsole.java:626)
 
	at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleWorker.doInBackground(JythonConsole.java:614)
 
	at java.desktop/javax.swing.SwingWorker$1.call(Unknown Source)
 
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
 
	at java.desktop/javax.swing.SwingWorker.run(Unknown Source)
 
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
 
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
 
	at java.base/java.lang.Thread.run(Unknown Source)
 
Caused by: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Bounds of result set does not match that of value set. (0 in vs 1 expected)
 
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:360)
 
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:334)
 
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.runTagHistoryQuery(GatewayInterface.java:802)
 
	at com.inductiveautomation.ignition.client.script.ClientTagUtilities.queryTagHistoryImpl(ClientTagUtilities.java:342)
 
	at com.inductiveautomation.ignition.common.script.builtin.AbstractTagUtilities.queryTagHistory(AbstractTagUtilities.java:731)
 
	at jdk.internal.reflect.GeneratedMethodAccessor108.invoke(Unknown Source)
 
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
 
	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:190)
 
	... 18 more
 
Caused by: java.lang.IllegalArgumentException: Bounds of result set does not match that of value set. (0 in vs 1 expected)
 
	at com.inductiveautomation.ignition.common.util.OperationAggregator$AggregationEntry.setResults(OperationAggregator.java:173)
 
	at com.inductiveautomation.ignition.gateway.sqltags.history.TagHistoryManagerImpl.queryHistory(TagHistoryManagerImpl.java:568)
 
	at com.inductiveautomation.ignition.gateway.tags.model.ProjectDefaultTagManagerFacade.queryHistory(ProjectDefaultTagManagerFacade.java:440)
 
	at com.inductiveautomation.ignition.gateway.servlets.gateway.functions.QueryTagHistory.invoke(QueryTagHistory.java:102)
 
	at com.inductiveautomation.ignition.gateway.servlets.Gateway.doPost(Gateway.java:435)
 
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:523)
 
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:590)
 
	at com.inductiveautomation.ignition.gateway.bootstrap.MapServlet.service(MapServlet.java:86)
 
	at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1410)
 
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764)
 
	at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1665)
 
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:527)
 
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131)
 
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578)
 
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
 
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:223)
 
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1570)
 
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
 
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1384)
 
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
 
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484)
 
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1543)
 
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
 
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1306)
 
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
 
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
 
	at com.inductiveautomation.catapult.handlers.RemoteHostNameLookupHandler.handle(RemoteHostNameLookupHandler.java:121)
 
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
 
	at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:301)
 
	at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:51)
 
	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:141)
 
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
 
	at org.eclipse.jetty.server.Server.handle(Server.java:563)
 
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$0(HttpChannel.java:505)
 
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:762)
 
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:497)
 
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:282)
 
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)
 
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
 
	at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
 
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:416)
 
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:385)
 
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:272)
 
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.lambda$new$0(AdaptiveExecutionStrategy.java:140)
 
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411)
 
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)
 
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194)
 
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)
 
	at java.lang.Thread.run(null)
 
Traceback (most recent call last):
  File "<input>", line 28, in <module>
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:360)
 
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:334)
 
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.runTagHistoryQuery(GatewayInterface.java:802)
 
	at com.inductiveautomation.ignition.client.script.ClientTagUtilities.queryTagHistoryImpl(ClientTagUtilities.java:342)
 
	at com.inductiveautomation.ignition.common.script.builtin.AbstractTagUtilities.queryTagHistory(AbstractTagUtilities.java:731)
 
	at jdk.internal.reflect.GeneratedMethodAccessor108.invoke(Unknown Source)
 
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
 
com.inductiveautomation.ignition.client.gateway_interface.GatewayException: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Bounds of result set does not match that of value set. (0 in vs 1 expected)

@Isaac_Fowler can you post the whole script? Specifically, what is at line 28?

Your path is a single string. The function expects a list of strings.

MMaynard, thanks for the suggestion! That did not seem to change anything by using fully filed out parameters. Same error as before with the code you provided.

Irose, my apologies, I copied the error from an iteration of the script where I had a bunch of other debug lines of code. Line 28 was simply:

tagHistory = system.tag.queryTagHistory(path, startTime, endTime)

Here I'll repost the stack trace but with the exact snippet of code I originally shared:

Error
Java Traceback:
Traceback (most recent call last):
  File "<input>", line 8, in <module>
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:360)

	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:334)

	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.runTagHistoryQuery(GatewayInterface.java:802)

	at com.inductiveautomation.ignition.client.script.ClientTagUtilities.queryTagHistoryImpl(ClientTagUtilities.java:342)

	at com.inductiveautomation.ignition.common.script.builtin.AbstractTagUtilities.queryTagHistory(AbstractTagUtilities.java:731)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.base/java.lang.reflect.Method.invoke(Unknown Source)

com.inductiveautomation.ignition.client.gateway_interface.GatewayException: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Bounds of result set does not match that of value set. (0 in vs 1 expected)


	at org.python.core.Py.JavaError(Py.java:547)

	at org.python.core.Py.JavaError(Py.java:538)

	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:192)

	at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction.__call__(ScriptManager.java:552)

	at org.python.core.PyObject.__call__(PyObject.java:494)

	at org.python.core.PyObject.__call__(PyObject.java:498)

	at org.python.pycode._pyx17.f$0(<input>:8)

	at org.python.pycode._pyx17.call_function(<input>)

	at org.python.core.PyTableCode.call(PyTableCode.java:173)

	at org.python.core.PyCode.call(PyCode.java:18)

	at org.python.core.Py.runCode(Py.java:1687)

	at org.python.core.Py.exec(Py.java:1731)

	at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:277)

	at org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter.java:130)

	at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleWorker.doInBackground(JythonConsole.java:626)

	at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleWorker.doInBackground(JythonConsole.java:614)

	at java.desktop/javax.swing.SwingWorker$1.call(Unknown Source)

	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)

	at java.desktop/javax.swing.SwingWorker.run(Unknown Source)

	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

	at java.base/java.lang.Thread.run(Unknown Source)

Caused by: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Bounds of result set does not match that of value set. (0 in vs 1 expected)

	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:360)

	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:334)

	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.runTagHistoryQuery(GatewayInterface.java:802)

	at com.inductiveautomation.ignition.client.script.ClientTagUtilities.queryTagHistoryImpl(ClientTagUtilities.java:342)

	at com.inductiveautomation.ignition.common.script.builtin.AbstractTagUtilities.queryTagHistory(AbstractTagUtilities.java:731)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.base/java.lang.reflect.Method.invoke(Unknown Source)

	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:190)

	... 19 more

Caused by: java.lang.IllegalArgumentException: Bounds of result set does not match that of value set. (0 in vs 1 expected)

	at com.inductiveautomation.ignition.common.util.OperationAggregator$AggregationEntry.setResults(OperationAggregator.java:173)

	at com.inductiveautomation.ignition.gateway.sqltags.history.TagHistoryManagerImpl.queryHistory(TagHistoryManagerImpl.java:568)

	at com.inductiveautomation.ignition.gateway.tags.model.ProjectDefaultTagManagerFacade.queryHistory(ProjectDefaultTagManagerFacade.java:440)

	at com.inductiveautomation.ignition.gateway.servlets.gateway.functions.QueryTagHistory.invoke(QueryTagHistory.java:102)

	at com.inductiveautomation.ignition.gateway.servlets.Gateway.doPost(Gateway.java:435)

	at javax.servlet.http.HttpServlet.service(HttpServlet.java:523)

	at javax.servlet.http.HttpServlet.service(HttpServlet.java:590)

	at com.inductiveautomation.ignition.gateway.bootstrap.MapServlet.service(MapServlet.java:86)

	at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1410)

	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764)

	at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1665)

	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:527)

	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131)

	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578)

	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)

	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:223)

	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1570)

	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)

	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1384)

	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)

	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484)

	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1543)

	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)

	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1306)

	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)

	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)

	at com.inductiveautomation.catapult.handlers.RemoteHostNameLookupHandler.handle(RemoteHostNameLookupHandler.java:121)

	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)

	at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:301)

	at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:51)

	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:141)

	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)

	at org.eclipse.jetty.server.Server.handle(Server.java:563)

	at org.eclipse.jetty.server.HttpChannel.lambda$handle$0(HttpChannel.java:505)

	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:762)

	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:497)

	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:282)

	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)

	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)

	at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)

	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:416)

	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:385)

	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:272)

	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.lambda$new$0(AdaptiveExecutionStrategy.java:140)

	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411)

	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)

	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194)

	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)

	at java.lang.Thread.run(null)

Traceback (most recent call last):
  File "<input>", line 8, in <module>
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:360)

	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:334)

	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.runTagHistoryQuery(GatewayInterface.java:802)

	at com.inductiveautomation.ignition.client.script.ClientTagUtilities.queryTagHistoryImpl(ClientTagUtilities.java:342)

	at com.inductiveautomation.ignition.common.script.builtin.AbstractTagUtilities.queryTagHistory(AbstractTagUtilities.java:731)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.base/java.lang.reflect.Method.invoke(Unknown Source)

com.inductiveautomation.ignition.client.gateway_interface.GatewayException: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Bounds of result set does not match that of value set. (0 in vs 1 expected)

As you can see, the error occurs on the final line 8.

pturmel, I believe the list is allowed to contain only one single string according to the Ignition documentation for queryTagHistory. But to your point I tried giving it multiple tags as well and unfortunately received the same error.

Hi all,

Spoke with Ignition Support to find the solution. This is a known bug with the Canary Historian Module. Real-time tag paths cannot be used for queries with Canary, and instead you must use full historical tag paths. The full explanation is available here