system.tag.queryTagHistory - gives uncertain initial value error

I am trying to access historical value of a tag (value about a minute ago)
(and subtract it from value now, to get the difference).
I am getting error ‘uncertain initial value’.
Here is my tag editor - script.

endTime =
startTime =, -1)
paths = [‘[default]History/building_h/Boiler_Gas_Flow_Accum’]
dataSet = system.tag.queryTagHistory(paths = paths, startDate = startTime, endDate = endTime, returnSize = 1, aggregationMode = “LastValue”, returnFormat = “Wide”)

May be my paths is not in correct syntax, I am unable to refer to an example of the correct path…
If someone has done anything similar to this, please let me know.
Thanks in advance.

paths = paths seems risky. Try changing the variable name to some non-keyword.

Tip: select a block of code and press the </> button to format it. It will preserve indentation and do some syntax highlighting for you.

This is not an issue with python. You can safely reuse the kwarg name for the actual variable.


Try setting your tag history config sample mode to discrete and see if your results are better.

Did you try setting the includeBoundingValues flag to True?