Invalid Memory Address error on aggregateWindow query from Script Builder

New user here. I’m trying to downsample sensor data from a home assistant instance. The aggregateWindow query built by the query builder throws a runtime error: “invalid memory address or nil point dereference error.” here’s the query:

from(bucket: “home_assistant/autogen”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == “humidity”
|> filter(fn: (r) => r["_field"] == “value”)
|> aggregateWindow(every: 1h, fn: mean, createEmpty: true)

raw data looks like this in the same query minus the aggregateWindow function:

Limiting the query to a single sensor makes no difference - still the same error. What am I doing wrong? TIA

Hello @egwent,
How many points are you querying for if you had to estimate?
What version of influx are you using?

A few hundred points to a few thousand depending on the range selected.

I’m using the Home Assistant InfluxDB addon v 4.4.1